我以root身份login到mysql。 我可以添加这样的用户:
CREATE USER test01@localhost IDENTIFIED BY 'test01';
当我尝试授予test01用户的特权时,似乎没有任何事情发生:
GRANT SELECT,INSERT,UPDATE,DELETE ON test_database.* TO 'test01'@'localhost';
test01用户的所有*_priv列都设置为N
任何想法,我在做什么错在这里? 谢谢!
这是SHOW GRANTS...的结果
mysql> SHOW GRANTS FOR 'test01'@'localhost'; +--------------------------------------------------------------------------------------+ | Grants for test01@localhost | +--------------------------------------------------------------------------------------+ | GRANT USAGE ON *.* TO 'test01'@'localhost' IDENTIFIED BY PASSWORD 'removed_hash' | +--------------------------------------------------------------------------------------+ 1 row in set (0.00 sec)
test01用户的所有* _priv列都设置为N.
你是否从mysql.user表中检查它,如下所示:
mysql> select * from mysql.user where user='test01' and host='localhost'\G
如果是这样,你在错误的地方检查。 此表中的所有权限都是全局权限,它使用on *。*进行分配。
当您on test_database.*上的数据库级别授予on test_database.* ,您必须检查mysql.db表:
select * from mysql.db where user='test01' and host='localhost' and db='test_database'\G
阅读更多: http : //dev.mysql.com/doc/refman/5.0/en/grant.html