当前位置:   article > 正文

MySQL创建用户报错:ERROR 1396 (HY000): Operation CREATE USER failed for ‘sc_slave‘@‘192.168.254.136‘_operation alter user failed for 'slave'@'%

operation alter user failed for 'slave'@'%

创建一个user用户时发现报错
Operation CREATE USER failed for ‘sc_slave’@‘192.168.254.136’

root@(none) 21:23  mysql>create user 'sc_slave'@'192.168.254.136' identified by '123456';
ERROR 1396 (HY000): Operation CREATE USER failed for 'sc_slave'@'192.168.254.136'
  • 1
  • 2

查询后发现可能是之前建过这个用户

然后查询资料想直接删除这个用户
发现直接报错

root@(none) 21:26  mysql>drop user 'sc_slave'@'%';
ERROR 1396 (HY000): Operation DROP USER failed for 'sc_slave'@'%'
  • 1
  • 2

后发现是要用这个语句删除
解决:

root@(none) 21:24  mysql>delete  from  mysql.user  where user ='sc_slave';
Query OK, 4 rows affected (0.01 sec)
  • 1
  • 2

必须先刷新权限后,再执行创建用户的命令,否则会再次报之前的错误

root@(none) 21:27  mysql>flush privileges;
Query OK, 0 rows affected (0.01 sec)
root@(none) 21:28  mysql>create user 'sc_slave'@'192.168.254.136' identified by '123456';
Query OK, 0 rows affected (0.00 sec)
  • 1
  • 2
  • 3
  • 4
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/在线问答5/article/detail/821540
推荐阅读
相关标签
  

闽ICP备14008679号