mysql忘记了谁登录:命令被拒绝给用户"@'%' [英] mysql forgets who is logged in: command denied to user ''@'%'

查看:80
本文介绍了mysql忘记了谁登录:命令被拒绝给用户"@'%'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正在运行show grants;表示我以具有数据库所有特权的用户身份登录.

Running show grants; indicates that I am logged in as a user with all privileges on a database.

运行show table status;会导致错误.并且该错误不显示我登录时使用的用户名!

Running show table status; results in an error. And the error does not show the username I am logged in as!

对于此命令,mysql似乎忘记了我是谁.其他选择语句也可以正常工作.谁能解释一下?怎么修?谢谢.

It's as if, for this command, mysql forgets who I am. Other select statements work fine. Can anyone explain this? How to fix? Thanks.

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.13-log Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show grants;
+---------------------------------------------------------------------------------------------------------------------+
| Grants for php@localhost                                                                                            |
+---------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'php'@'localhost' IDENTIFIED BY PASSWORD '*8F5FF90079BC601F8EA7C148475658E65A0C029D' |
| GRANT ALL PRIVILEGES ON `sunflower_work`.* TO 'php'@'localhost'                                                     |
| GRANT ALL PRIVILEGES ON `news_demo`.* TO 'php'@'localhost'                                                          |
| GRANT ALL PRIVILEGES ON `news_base`.* TO 'php'@'localhost'                                                          |
+---------------------------------------------------------------------------------------------------------------------+
4 rows in set (0.00 sec)

mysql> show table status from sunflower_work;
ERROR 1143 (42000): SELECT command denied to user ''@'%' for column 'uid' in table 'users'
mysql>

update ...根据Tomalak的建议,我删除了该用户,并使用更完整的特权和密码重新创建了该用户.问题仍然存在.现在看起来像这样:

update... as suggested by Tomalak, I deleted the user and recreated with fuller privileges and no password. Still the problem persists. Now it looks like this:

mysql> show grants;
+--------------------------------------------------+
| Grants for php@localhost                         |
+--------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'php'@'localhost' |
+--------------------------------------------------+
1 row in set (0.00 sec)

mysql> show table status;
ERROR 1143 (42000): SELECT command denied to user ''@'%' for column 'uid' in table 'users'
mysql> 

推荐答案

问题可能出在数据库中.这些视图可能是具有特定权限的.

The issue is probably that you have VIEWS in your database. The views are probably created with specific rights.

您可以从错误消息中看出,它抱怨一个不同的用户,而不是您登录的用户.这是因为对于视图,您可以指定如何确定视图必须具有哪些权限才能查看数据.

As you can tell by your error message, it complains about a different user than the one you are logged in is. This is because for a view you can specify how to determine what rights the view has to look at data.

当您进入数据库时​​,尝试输入:

When you go to your database, try typing:

SHOW FULL TABLES IN sunflower_work WHERE TABLE_TYPE NOT LIKE '%table%';

然后,您可能希望查看其中特定视图的权利.

Then you may wish to look into the rights of the specific views that are there.

这篇关于mysql忘记了谁登录:命令被拒绝给用户"@'%'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆