为什么不能在mysql中创建新用户? [英] why can't create a new user in mysql?
问题描述
mysql> select user,host from mysql.user;
+------------------+-----------+
| user | host |
+------------------+-----------+
| root | 127.0.0.1 |
| root | ::1 |
| debian-sys-maint | localhost |
| developer | localhost |
| jack | localhost |
| root | localhost |
| root | rebuild |
+------------------+-----------+
7 rows in set (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| wpdatabase |
+--------------------+
4 rows in set (0.00 sec)
mysql> CREATE USER wpuser@localhost;
ERROR 1396 (HY000): Operation CREATE USER failed for 'wpuser'@'localhost'
为什么不能在mysql中创建新用户?用户 wpuser
不在表 user
中.我从未使用过数据库,所以谁能帮我创建一个新用户?
Why can't create a new user in mysql? The user wpuser
is not in the table user
.
I neved used databases, so can anyone help me on how to create a new user ?
不,不是密码的问题(123456是mysql数据库的key).
No,it is not the problem of password(123456 is the key of mysql database).
mysql> CREATE USER 'wpuser'@'localhost' IDENTIFIED BY '123456';
ERROR 1396 (HY000): Operation CREATE USER failed for 'wpuser'@'localhost'
太奇怪了,请继续.
为什么 CREATE USER wpuser@localhost;
不能;CREATE USER wpusers@localhost;
可以吗?
Why CREATE USER wpuser@localhost;
can't ; CREATE USER wpusers@localhost;
can?
推荐答案
我认为我遇到了同样的问题.我不小心创建了myuser",使用下面的命令删除了它,然后我无法创建用户,尽管它没有出现在 mysql.user
表
I had the same problem I believe. I accidentally created 'myuser', deleted it using the command below, and then I cannot create the user, although its not showing up on mysql.user
table
我尝试了这些删除命令,但无济于事.
I tried these commands for deleting but to no avail.
delete user from mysql.user where user='myuser'
delete user from mysql.user where user='myuser' and host='localhost'
delete user from mysql.user where user='myuser' and host='%'
当我使用此命令删除用户时,它对我有用.
It worked for me when I use this command to remove the user.
DROP USER 'myuser'@'localhost';
在尝试这些命令之间,我FLUSH PRIVILEGES
好像我正在腹泻.因此,如果它仍然不起作用,请按照 Begueradj 的建议进行操作.
In between trying out these commands I FLUSH PRIVILEGES
as though I'm on diarrhoea. So in case it still does not work, do what Begueradj suggested.
这篇关于为什么不能在mysql中创建新用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!