一尘不染

错误1396(HY000):操作CREATE USER对于'jack'@'localhost'失败

mysql

我似乎无法重新创建一个已删除的简单用户,即使以root用户身份在MySQL中也是如此。

我的情况是:用户’jack’曾经存在,但是我从mysql.user中删除了它以重新创建它。我在那张桌子上看不到任何痕迹。如果我对其他随机用户名(例如“
jimmy”)执行此命令,则该命令会正常工作(就像最初对“ jack”所做的一样)。

我已经做了些什么来破坏用户“ jack”,以及如何撤销该破坏,以便重新创建“ jack”作为此安装的MySQL的有效用户?

请参见下面的示例。(当然,最初,在创建“ jack”和将其删除之间有很多时间。)

mysql> CREATE USER 'jack'@'localhost' IDENTIFIED BY 'test123';
Query OK, 0 rows affected (0.00 sec)

mysql> select user,host from user;
+------------------+-----------------+
| user             | host            |
+------------------+-----------------+
| root             | 127.0.0.1       |
| debian-sys-maint | localhost       |
| jack             | localhost       |
| root             | localhost       |
| root             | russ-elite-book |
+------------------+-----------------+
5 rows in set (0.00 sec)

mysql> delete from user where user = 'jack';
Query OK, 1 row affected (0.00 sec)

mysql> select user,host from user;
+------------------+-----------------+
| user             | host            |
+------------------+-----------------+
| root             | 127.0.0.1       |
| debian-sys-maint | localhost       |
| root             | localhost       |
| root             | russ-elite-book |
+------------------+-----------------+
4 rows in set (0.00 sec)

mysql> CREATE USER 'jack'@'localhost' IDENTIFIED BY 'test123';
ERROR 1396 (HY000): Operation CREATE USER failed for 'jack'@'localhost'
mysql> CREATE USER 'jimmy'@'localhost' IDENTIFIED BY 'test123';
Query OK, 0 rows affected (0.00 sec)

mysql> select user,host from user;
+------------------+-----------------+
| user             | host            |
+------------------+-----------------+
| root             | 127.0.0.1       |
| debian-sys-maint | localhost       |
| jimmy            | localhost       |
| root             | localhost       |
| root             | russ-elite-book |
+------------------+-----------------+
5 rows in set (0.00 sec)

阅读 311

收藏
2020-05-17

共1个答案

一尘不染

尝试做一个FLUSH PRIVILEGES;
关于该错误代码的此MySQL错误文章似乎在刷新privs之后报告了与您类似的情况下的某些成功。

2020-05-17