MySQL:授予 CREATE 权限被拒绝
我设置了一个数据库&用户以及我通常所做的授予权限,但我仍然被拒绝访问,我不知道为什么:
[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)
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 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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不相信你的语法是正确的。您指定:
数据库级 GRANT 的预期语法为:
ON $db.$table
。基于此,您仅授予名为“localhost”的表。更改为:I don't believe your syntax is right. You're specifying:
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:您的用户 redditonrails 似乎拥有所有权限
redditonrails_development
.localhost
这意味着
redditonrails_development
数据库和localhost
表。你想要的是那里redditonrails_development
.*
女巫意味着你拥有所有表的所有特权(甚至是你试图创建的新表)
,或者至少是这样我怎么看。
It would seem that your user redditonrails has all privilages on
redditonrails_development
.localhost
which would mean
redditonrails_development
database andlocalhost
table. what you want is to have thereredditonrails_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.