【发布时间】:2010-06-10 03:49:53
【问题描述】:
为什么下面的授权语句可能不起作用?
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)
似乎这些资助选项每次都能吸引我。我想我已经记住了它们,并且文档似乎也可以检查出来,但是它们经常无法正常工作。我错过了什么?
【问题讨论】:
-
我假设您在最后两行之间留了一行(要求输入密码“foo”的那一行)?
-
不,这就是问题所在。 MySQL 没有要求输入密码,只是给了我一个拒绝访问错误。
-
您是否有一个 ~/.my.cnf 文件,客户端可能正在从中读取(不正确的)密码?
标签: mysql mysql-error-1045 sql-grant