This error is reported when creating a user:
ERROR 1396 (HY000): Operation CREATE USER failed for ' abc ' @ ' localhost '
The reason is that the user is already in MySQL, remove the delete directly from the Mysql.user, and then refresh the permissions flush privileges, then build the user will not have this problem.
If it is the drop user, MySQL will automatically refresh the internal, then the building will not have this problem.
For example, 1--delete Delete:
mysql> create user ' abc ' @ ' localhost ';
Query OK, 0 rows Affected (0.00 sec)
Mysql> select User,host from user;
+------+-----------+
| user | Host |
+------+-----------+
| Root | 127.0.0.1 |
| ABC | localhost |
| Root | localhost |
+------+-----------+
3 Rows in Set (0.00 sec)
mysql> Delete from user where user= ' abc ';
Query OK, 1 row Affected (0.00 sec)
Mysql> select User,host from user;
+------+-----------+
| user | Host |
+------+-----------+
| Root | 127.0.0.1 |
| Root | localhost |
+------+-----------+
2 rows in Set (0.00 sec)
Create a user with the same name again with the following error:
mysql> create user ' abc ' @ ' localhost ';
ERROR 1396 (HY000): Operation CREATE USER failed for ' abc ' @ ' localhost '
Here to refresh the permissions, after the refresh can be created;
mysql> flush privileges;
Query OK, 0 rows Affected (0.00 sec)
mysql> create user ' abc ' @ ' localhost ';
Query OK, 0 rows Affected (0.00 sec)
Mysql> select User,host from user;
+------+-----------+
| user | Host |
+------+-----------+
| Root | 127.0.0.1 |
| ABC | localhost |
| Root | localhost |
+------+-----------+
3 Rows in Set (0.00 sec)
For example, 2--drop Delete can be created directly:
mysql> drop user ' abc ' @ ' localhost ';
Query OK, 0 rows Affected (0.00 sec)
Mysql> select User,host from user;
+------+-----------+
| user | Host |
+------+-----------+
| Root | 127.0.0.1 |
| Root | localhost |
+------+-----------+
2 rows in Set (0.00 sec)
mysql> create user ' abc ' @ ' Loaclhost ';
Query OK, 0 rows Affected (0.00 sec)
This article is from the "Model Student's Learning blog" blog, please be sure to keep this source http://mofansheng.blog.51cto.com/8792265/1980514
Mysql error 1396 (HY000) wrong solution