无法对 MySQL 用户设置权限 [英] Can't set permissions on MySQL user
问题描述
我正在尝试使用以下命令为 MySQL 用户设置权限.
I am trying to set the permissions for a MySQL user using the following command.
在 joomla.* 上授予所有权限给 user@localhost;
GRANT ALL ON joomla.* to user@localhost;
我尝试了很多版本,但它们都返回了:错误 1044 (42000):用户 ''@'localhost' 对数据库 'joomla2' 的访问被拒绝
I have tried so many versions but they all return: ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'joomla2'
这似乎表明用户名user"没有通过?我已经尝试了上述命令的许多版本,还有什么需要注意的吗.
Which seems to indicate that the username "user" is not getting passed? I have tried many versions of the command above, is there something else I need to be aware of.
PS:我的名字实际上不是用户",以防有人提到它是保留字或类似的东西.
PS: my name is not actually "user" just in case someone mentions that it is a reserved word or something similar.
推荐答案
尝试查看权限表.例如:
Try having a look in the privilege tables. For instance:
> use mysql;
> select * from db;
这可能会提示您出了什么问题.
That might give you a hint as to what's going wrong.
您也可以通过指定 user@'127.0.0.1' 并使用 -H 127.0.0.1 标志进行连接(如果您使用的是 mysql cmd 行客户端),尝试通过 tcp 而不是 unix 套接字进行连接.
You might also try connecting over tcp rather than unix socket by specifying user@'127.0.0.1' and connecting with the -H 127.0.0.1 flag (if you're using the mysql cmd line client).
您是否尝试过使用 GRANT 语句的IDENTIFIED BY "mypwd""部分指定密码?
Have you tried specifying a password using the 'IDENTIFIED BY "mypwd"' part of the GRANT statement?
这篇关于无法对 MySQL 用户设置权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!