MySQL 创建用户失败案例一则
create user 'someuser'@'localhost' identified by 'somepassword';
ERROR 1396 (HY000): Operation CREATE USER failed for 'someuser'@'localhost'
查询数据库用户信息:
select user from mysql.user;
+-----------+
| user |
+-----------+
| mysql.sys |
| root |
+-----------+
解决方案:
grant all privileges on *.* to 'someuser'@'localhost' with grant option;
drop user 'someuser'@'localhost';
flush privileges;
原因分析:用delete命令删除了user表中的数据会出现这种情况。删除用户用drop user而不是delete。
历史文章: