ERROR 1396 (HY000)
2018-08-21 本文已影响0人
帕博雷克斯丢丢
ERROR 1396 (HY000): Operation DROP USER failed for 'bank'@'%'
删除用户bank#localhost
时,报错;
1:
事件:
mysql> select User from user;
+---------------+
| User |
+---------------+
| bank |
| mysql.session |
| mysql.sys |
| root |
+---------------+
4 rows in set (0.00 sec)
mysql> drop user bank;
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables
option so it cannot execute this statement
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> drop user bank;
ERROR 1396 (HY000): Operation DROP USER failed for 'bank'@'%'
mysql> drop user bank@localhost;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit;
Bye
分析&解决:
第一次报错,根据提示信息ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
可知,可能是由于删除用户前没有进行权限刷新导致;
所以执行flush privileges
刷新权限;
第二次报错ERROR 1396 (HY000): Operation DROP USER failed for 'bank'@'%'
,根据提示,是由于没有指定主机所致;
因为这里我创建的是本地用户,所以用bank@localhost
,如果想删除非本地用户,则用bank@'%'
(不包括localhost
),'%'
表示所有非本地主机。