2

为什么以下授权声明可能不起作用?

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)

似乎这些赠款选项每次都能吸引我。我想我已经记住了它们,并且文档似乎也可以检查出来,但是它们经常无法正常工作。我错过了什么?

4

1 回答 1

1

尝试类似:

mysql -ukylie -pfoo kylie

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

感谢评论更新。

于 2010-06-10T03:54:52.720 回答