美文网首页
ERROR 1396 (HY000)

ERROR 1396 (HY000)

作者: 帕博雷克斯丢丢 | 来源:发表于2018-08-21 19:14 被阅读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),'%'表示所有非本地主机。

    相关文章

      网友评论

          本文标题:ERROR 1396 (HY000)

          本文链接:https://www.haomeiwen.com/subject/hrzjiftx.html