[MySQL] error 1396 (HY000): Operation create user failed for ‘MySQL’ @’localhost ‘

Error 1396 (HY000): Operation create user failed for ‘MySQL’ @’localhost ‘

reason:

Delete MySQL users directly use delete from mysql.user where user like ‘%mysql%’;

Then create MySQL again and report the user’s error;

solve:

Check to see if there is this user

mysql> select distinct user from mysql.user;
+-------+
| user  |
+-------+
| root  |
+-------+
1 rows in set (0.00 sec)

Using drop to delete users

mysql> drop user 'mysql'@'localhost';

After deleting, you can re create the user. If you report the same error, you may encounter a MySQL bug and need to refresh the permissions

mysql> flush privileges;

Then recreate the user

mysql> create user 'mysql'@'localhost' identified by 'mysql';

Read More: