我设置了一个数据库&用户以及我通常做的授权权限,我仍然被拒绝访问,我不确定原因:
[root@server23 redditonrails]# mysql -u redditonrails -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 431954
Server version: 5.0.45 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use redditonrails_development;
Database changed
mysql> create table test;
ERROR 1142 (42000): CREATE command denied to user 'redditonrails'@'localhost' for table 'test'
mysql> show grants;
+------------------------------------------------------------------------------------------------+
| Grants for redditonrails@localhost |
+------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'redditonrails'@'localhost' IDENTIFIED BY PASSWORD '*******' |
| GRANT ALL PRIVILEGES ON `redditonrails_test`.`localhost` TO 'redditonrails'@'localhost' |
| GRANT ALL PRIVILEGES ON `redditonrails_development`.`localhost` TO 'redditonrails'@'localhost' |
| GRANT ALL PRIVILEGES ON `redditonrails`.`localhost` TO 'redditonrails'@'localhost' |
+------------------------------------------------------------------------------------------------+
4 rows in set (0.00 sec)
mysql> SELECT USER(),CURRENT_USER();
+-------------------------+-------------------------+
| USER() | CURRENT_USER() |
+-------------------------+-------------------------+
| redditonrails@localhost | redditonrails@localhost |
+-------------------------+-------------------------+
1 row in set (0.00 sec)
答案 0 :(得分:2)
我不相信你的语法是对的。你指的是:
授予所有特权
redditonrails_development
。localhost
db-level GRANT的预期语法是:ON $db.$table
。基于此,您只能在名为“localhost”的表上授予权限。改为:
授予所有特权
redditonrails_development
。*
答案 1 :(得分:1)
您的用户redditonils似乎拥有所有特权
redditonrails_development
。localhost
这意味着redditonrails_development
数据库和localhost
表。你想要的就是拥有
redditonrails_development
。*
或者至少我是这样看的。