分享案例一则,报错信息如下:
代码语言:javascript复制create user 'someuser'@'localhost' identified by 'somepassword';
ERROR 1396 (HY000): Operation CREATE USER failed for 'someuser'@'localhost'
查询数据库用户信息:
代码语言:javascript复制select user from mysql.user;
-----------
| user |
-----------
| mysql.sys |
| root |
-----------
解决方案:
代码语言:javascript复制grant all privileges on *.* to 'someuser'@'localhost' with grant option;
drop user 'someuser'@'localhost';
flush privileges;
原因分析:用delete命令删除了user表中的数据会出现这种情况。删除用户用drop user而不是delete。