mysql创建用户报错bug——ERROR 1396 (HY000): Operation CREATE USER failed for ‘zabbix‘@‘localhost‘

背景:mysql中删除又想重建zabbix用户,但是执行创建命令报错。

mysql> select host,user from user;
+-----------+------------------+
| host      | user             |
+-----------+------------------+
| localhost | mysql.infoschema |
| localhost | mysql.session    |
| localhost | mysql.sys        |
| localhost | root             |
+-----------+------------------+
4 rows in set (0.00 sec)
mysql> create user 'zabbix'@'localhost' identified by 'Test@1234';
ERROR 1396 (HY000): Operation CREATE USER failed for 'zabbix'@'localhost'

以看到mysql用户中并没有zabbix,可是却无法创建,经查阅这是一个mysql官方bug:
This bug has been sitting on bugs.mysql.com since 2007 and this thread is mainly just a parroting of all those wrong answers even up to a year ago.

解决方法:

drop user zabbix@localhost;
flush privileges;
create user zabbix@localhost identified by 'admins_password'

Guess you like

Origin blog.csdn.net/weixin_42575806/article/details/111370900