MySQL 授权问题
为什么下面的 grant 语句可能无法工作?
grant all on kylie.* to 'kylie'@'localhost' identified by 'foo';
这是完整的输出。
$ mysql -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 63
Server version: 5.1.37 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases like 'kylie%';
+-------------------+
| Database (kylie%) |
+-------------------+
| kylie |
+-------------------+
1 row in set (0.00 sec)
mysql> grant all on kylie.* to 'kylie'@'localhost' identified by 'foo';
Query OK, 0 rows affected (0.02 sec)
mysql> exit
Bye
$ mysql -u kylie
ERROR 1045 (28000): Access denied for user 'kylie'@'localhost' (using password: YES)
看来这些资助选项每次都能让我受益匪浅。我想我已经记住了它们,并且文档似乎也检查过了,但它们经常无法工作。我缺少什么?
Why might the following grant statement fail to work?
grant all on kylie.* to 'kylie'@'localhost' identified by 'foo';
Here's the complete output.
$ mysql -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 63
Server version: 5.1.37 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases like 'kylie%';
+-------------------+
| Database (kylie%) |
+-------------------+
| kylie |
+-------------------+
1 row in set (0.00 sec)
mysql> grant all on kylie.* to 'kylie'@'localhost' identified by 'foo';
Query OK, 0 rows affected (0.02 sec)
mysql> exit
Bye
$ mysql -u kylie
ERROR 1045 (28000): Access denied for user 'kylie'@'localhost' (using password: YES)
It seems that these grant options get me every time. I think I have them memorized and the docs seem to check out too, but they often fail to work. What am I missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试如下操作:
最后一个 kylie 应该告诉它使用 kylie 作为默认数据库(即您有权使用的数据库)。它可能不是必需的,但我想知道它是否适合您。
感谢评论的更新。
Try something like:
The last kylie should tell it to use kylie as the default database (i.e. the one you have permission for). It may not be required, but I'm wondering if it'll work or not for you.
Updated thanks to the comments.