mysql ERROR 1396 (HY000): Operation CREATE USER failed 解决办法
2022/5/26 2:21:35
本文主要是介绍mysql ERROR 1396 (HY000): Operation CREATE USER failed 解决办法,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
原因:MySQL账户表中已经存在这个要创建的用户
操作分析:
当创建新用户时会提示这个新用户创建失败,但是当解决创建失败的问题后再次重新创建这个新用户,则会报这个错误
# 创建新用户,提示root用户没有SYSTEM_USER权限,创建失败 mysql> create user 'proxysql'@'192.168.20.%' identified with mysql_native_password by 'iD!^^EjU#Yxr5$p'; ERROR 1227 (42000): Access denied; you need (at least one of) the SYSTEM_USER privilege(s) for this operation # 解决root用户没有SYSTEM_USER权限的问题 mysql> grant system_user on *.* to 'root'; Query OK, 0 rows affected (0.00 sec) # 再次创建该用户提示报错 mysql> create user 'proxysql'@'192.168.20.%' identified with mysql_native_password by 'iD!^^EjU#Yxr5$p'; ERROR 1396 (HY000): Operation CREATE USER failed for 'proxysql'@'192.168.20.%' # 实际情况是在第一次创建时,虽然提示root用户没有SYSTEM_USER权限,但是mysql.user表中已经有这个用户了 # 解决办法,删除这个用户信息,然后重新创建即可 mysql> drop user 'proxysql'@'192.168.20.%' mysql> delete from mysql.user where user = 'proxysql'@'192.168.20.%'; mysql> delete from mysql.db where user = 'proxysql'@'192.168.20.%'; mysql> flush privileges; mysql> create user 'proxysql'@'192.168.20.%' identified with mysql_native_password by 'iD!^^EjU#Yxr5$p'; Query OK, 0 rows affected (0.00 sec) mysql> GRANT USAGE,process,replication slave,replication client ON *.* TO 'proxysql'@'192.168.20.%' with grant option; Query OK, 0 rows affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.01 sec)
这篇关于mysql ERROR 1396 (HY000): Operation CREATE USER failed 解决办法的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-04部署MySQL集群项目实战:新手入门教程
- 2024-11-04如何部署MySQL集群资料:新手入门指南
- 2024-11-02MySQL集群项目实战:新手入门指南
- 2024-11-02初学者指南:部署MySQL集群资料
- 2024-11-01部署MySQL集群教程:新手入门指南
- 2024-11-01如何部署MySQL集群:新手入门教程
- 2024-11-01部署MySQL集群学习:新手入门教程
- 2024-11-01部署MySQL集群入门:新手必读指南
- 2024-10-23BinLog入门:新手必读的MySQL二进制日志指南
- 2024-10-23Binlog入门:MySQL数据库的日志管理指南