开发者

mysql: cannot create user after delete the user with phpmyadmin

I was trying to create a mysql user with:

$ mysql5 -u root -p
$ [enter password]
$ create user 'name'@'localhost' indentified by '123456';

Then I accidentally deleted the user while using phpMyAdmin.

So I came back to terminal to create the user again with the lines above. Then it gives me an error:

ERROR 1396 (HY000): Operation CREATE USER failed for 'name'@'localhost'

How do I fix this? I开发者_高级运维 need to create the user with the same name and password.

Thanks in advance,

Milo


It's very hard to see the issue here without some testing, but you may want to try:

flush privileges;


When you delete a user using a tool such as MySQL admin or Mysql Workbench, it is not enough to delete the row in the table 'user'. You have to drop the user as using the following sentence:

DROP USER user [, user] ...

you can check more information here: https://dev.mysql.com/doc/refman/5.6/en/drop-user.html

Here is an example:

DROP USER 'usertodelete'@'localhost';
FLUSH PRIVILEGES;

You can check if everything went well with:

use mysql;

select * from user;

Best!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜