Description: After removing the user Molewan in Mariadb, the business has a need to re-establish a user named Molewan
1, check the database, found that no Molewan users
MariaDB [mysql]> Select User,host from mysql.user;+----------+------------+| user | Host |+----------+------------+| Molewan1 | 10.10.10.% | | admin | localhost |+----------+------------+2 rows in Set (0.00 sec)
2, create a new Molewan user, error
MariaDB [mysql]> Create user [email protected] ' 10.10.10.% ' identified by ' Molewan '; ERROR 1396 (HY000): Operation CREATE user failed for ' Molewan ' @ ' 10.10.10.% ' when remembered to delete Molewan user, is deleted by Delete command MARIADB [ Mysql]> Delete from Mysql.user where user= "molewan1" and host = "10.10.10.%"; MariaDB [mysql]> flush Privileges;
3, check the information, found that if you want to completely do not apply to a user, we recommend using the Drop command
MariaDB [mysql]> Drop User [email protected] ' 10.10.10.% '; Query OK, 0 rows Affected (0.00 sec) MariaDB [mysql]> flush privileges; Query OK, 0 rows Affected (0.00 sec)
Added: The DROP user does not automatically abort a connected session, that is, if the deleted user has already connected to the server before the deletion, and the connection has not been interrupted, then it can continue to perform certain operations at this time, but its identity has become heihu.
4. Rebuilding Molewan Users
MariaDB [mysql]> Create user [email protected] ' 10.10.10.% ' identified by ' Molewan '; Query OK, 0 rows affected (0.01 sec) MariaDB [mysql]> Select User,host from mysql.user;+---------+------------+| user | Host |+---------+------------+| Molewan | 10.10.10.% | | admin | localhost |+---------+------------+2 rows in Set (0.00 sec)
This article is from the "Frozen vs watermelon" blog, so be sure to keep this source http://molewan.blog.51cto.com/287340/1940610
MySQL rebuilds a user account (ERROR 1396 (HY000): Operation CREATE User failed)