为什么以下 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)
这些资助选项似乎每次都能让我受益。我想我已经记住了它们并且文档似乎也可以检查,但它们经常无法工作。我错过了什么?
最佳答案
尝试这样的事情:
mysql -ukylie -pfoo kylie
最后一个 kylie 应该告诉它使用 kylie 作为默认数据库(即你有权限的数据库)。它可能不是必需的,但我想知道它是否适合您。
更新感谢评论。
关于MySQL 授权问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3011516/