MySQL 授权问题

发布于 2024-09-05 05:24:06 字数 866 浏览 2 评论 0原文

为什么下面的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

美男兮 2024-09-12 05:24:06

尝试如下操作:

mysql -ukylie -pfoo kylie

最后一个 kylie 应该告诉它使用 kylie 作为默认数据库(即您有权使用的数据库)。它可能不是必需的,但我想知道它是否适合您。

感谢评论的更新。

Try something like:

mysql -ukylie -pfoo kylie

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文