开发者

MySQL: grant permissions denied for CREATE

I setup a database & user along with grant permissions how I normally do and I'm still getting access denied and I'm not sure why:

[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 AL开发者_Go百科L 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)


I don't believe your syntax is right. You're specifying:

GRANT ALL PRIVILEGES ON redditonrails_development.localhost

The expected syntax for db-level GRANT is: ON $db.$table. Based on this, you're only granting on the table named "localhost". Change to:

GRANT ALL PRIVILEGES ON redditonrails_development.*


It would seem that your user redditonrails has all privilages on redditonrails_development.localhost

which would mean redditonrails_development database and localhost table. what you want is to have there

redditonrails_development.*

witch would mean you have all privilages on all tables (even the new ones you're trying to create)

or at least that's how I see it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜