Jul 10

Ran across this one quite unexpectedly. I was creating a new database in MySQL and creating a user that would be associated with that database. when I executed the command:

CREATE USER 'abc'@'localhost' IDENTIFIED BY 'password';

I was promptly presented with the error message: ERROR 1396 (HY000): Operation CREATE USER failed. This error didn’t give much explanation as to what the root cause was. After a bit of digging, I learned that the user must already exist or partially exist and that’s causing the issue. My first instinct was to do a

drop user 'abc'@'localhost'

or a

delete from mysql.user where user = 'abc'@'localhost';
delete from mysql.db where user = 'abc'@'localhost';

My next attempt to create the user yielded the same error. I had forgotten one key command:


Once that was executed, I was able to create the user successfully.

written by ikhnaton

Leave a Reply

You must be logged in to post a comment.