1396 - Operation CREATE USER failed

mysql重新创建用户时出现1396 - Operation CREATE USER failed;
flush PRIVILEGES 刷新权限后,用户能正常创建。

1.  查看当前用户

mysql> select user();
+----------------+
| user()         |
+----------------+
| root@localhost |
+----------------+
1 row in set

 

2.查看mysql的user表中是否存在用户testuser1

mysql> select host, user, password ,ssl_cipher, x509_issuer,x509_subject from user  where user='testuser1';
+------+-----------+-------------------------------------------+------------+-------------+--------------+
| host | user      | password                                  | ssl_cipher | x509_issuer | x509_subject |
+------+-----------+-------------------------------------------+------------+-------------+--------------+
| %    | testuser1 | *06C0BF5B64ECE2F648B5F048A71903906BA08E5C |            |             |              |
+------+-----------+-------------------------------------------+------------+-------------+--------------+
1 row in set

 

3.删除user表中的用户testuser1

mysql> delete from user where user in ('testuser1');
Database changed

mysql> select host, user, password ,ssl_cipher, x509_issuer,x509_subject from user  where user='testuser1';
Empty set

 

4. 创建用户testuser1时出现1396错误

mysql> create user  testuser1@'%' identified by 'test1';

1396 - Operation CREATE USER failed for 'testuser1'@'%'

 

5.刷新权限

mysql> flush PRIVILEGES;
Query OK, 0 rows affected

 

6.用flush privileges 刷新后,重建用户testuser1,正常

mysql> create user  testuser1@'%' identified by 'test1';

Database changed

7.查询user表,用户testuser1已经被创建
mysql> select host, user, password ,ssl_cipher, x509_issuer,x509_subject from user  where user='testuser1';
+------+-----------+-------------------------------------------+------------+-------------+--------------+
| host | user      | password                                  | ssl_cipher | x509_issuer | x509_subject |
+------+-----------+-------------------------------------------+------------+-------------+--------------+
| %    | testuser1 | *06C0BF5B64ECE2F648B5F048A71903906BA08E5C |            |             |              |
+------+-----------+-------------------------------------------+------------+-------------+--------------+
1 row in set

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值