小编典典

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

all

我似乎无法重新创建一个已删除的简单用户,即使是 MySQL 中的 root。

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

我对损坏用户“jack”做了什么?如何撤消该损坏以重新创建“jack”作为此 MySQL 安装的有效用户?

请参见下面的示例。(当然,最初,“杰克”的创作和他的撤职之间有很长的时间。)

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)

阅读 111

收藏
2022-03-28

共1个答案

小编典典

尝试做一个FLUSH PRIVILEGES;. 这个关于该错误代码的 MySQL
错误帖子
似乎在刷新 privs 后在类似于您的情况下报告了一些成功。

2022-03-28