Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR 1396 (HY000): Operation CREATE USER failed

Tags:

mysql

i was creating a db in mysql and ran commands-

create database projectdb;
create user 'aquaman'@'localhost' identified by password'aquaman123';

and it gave error-

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

anyone please help me how to resolve it

like image 468
aquaman Avatar asked Jul 13 '26 19:07

aquaman


2 Answers

I ran into this issue having previously deleted a user of the same name directly from the user table:

DELETE FROM mysql.user WHERE User='aquaman';

But this isn't the right way to delete a user! Having dropped the user properly, via:

DROP USER 'aquaman';

...I was once again able to successfully create a user with this name.

like image 73
Nick F Avatar answered Jul 15 '26 12:07

Nick F


Incorrect Syntax!!

You have included an extra password in your code. Change the code from:

create user 'aquaman'@'localhost' identified by password'aquaman123';

TO:

CREATE USER 'aquaman'@'localhost' IDENTIFIED BY 'aquaman123';

Please check the documentation: http://dev.mysql.com/doc/refman/5.0/en/create-user.html

like image 43
Ataboy Josef Avatar answered Jul 15 '26 12:07

Ataboy Josef



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!