错误 1396 (HY000):操作 CREATE USER 对 'jack'@'localho

ERROR 1396 (HY000): Operation CREATE USER failed for #39;jack#39;@#39;localhost#39;(错误 1396 (HY000):操作 CREATE USER 对 jack@localhost 失败)
本文介绍了错误 1396 (HY000):操作 CREATE USER 对 'jack'@'localhost' 失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

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

I seem to be unable to re-create a simple user I've deleted, even as root in MySQL.

我的情况:用户 'jack' 以前存在过,但我从 mysql.user 中删除了它以重新创建它.我在那个桌子上看不到这方面的痕迹.如果我为其他一些随机用户名执行此命令,例如jimmy",它可以正常工作(就像它最初对jack"所做的一样).

My case: user 'jack' existed before, but I deleted it from mysql.user in order to recreate it. I see no vestiges of this in that table. If I execute this command for some other, random username, say 'jimmy', it works fine (just as it originally did for 'jack').

我做了什么来破坏用户 'jack' 以及如何撤消该损坏以便重新创建 'jack' 作为此 MySQL 安装的有效用户?

What have I done to corrupt user 'jack' and how can I undo that corruption in order to re-create 'jack' as a valid user for this installation of MySQL?

请参见下面的示例.(当然,最初,'jack'的创建和他的删除之间有很多时间.)

See example below. (Of course, originally, there was much time between the creation of 'jack' and his removal.)

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)

推荐答案

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

Try doing a FLUSH PRIVILEGES;. This MySQL bug post on that error code appears to report some success in a case similar to yours after flushing privs. 

这篇关于错误 1396 (HY000):操作 CREATE USER 对 'jack'@'localhost' 失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Can#39;t Create Entity Data Model - using MySql and EF6(无法创建实体数据模型 - 使用 MySql 和 EF6)
MySQL select with CONCAT condition(MySQL选择与CONCAT条件)
Capitalize first letter of each word, in existing table(将现有表格中每个单词的首字母大写)
How to retrieve SQL result column value using column name in Python?(如何在 Python 中使用列名检索 SQL 结果列值?)
Update row with data from another row in the same table(使用同一表中另一行的数据更新行)
Exporting results of a Mysql query to excel?(将 Mysql 查询的结果导出到 excel?)