admin管理员组

文章数量:1638918

为mysql创建新用户后,使用root用户登录,进行授权,发现以下错误:

 翻阅了很多csdn文章,瞎掰的太多了。

 

mysql> grant all on performance_schema.* to 'testuser'@'%';
ERROR 1044 (42000): Access denied for user 'root'@'localhost' to database 'performance_schema'
mysql> grant all on information_schema.* to 'testuser'@'%';
ERROR 1044 (42000): Access denied for user 'root'@'localhost' to database 'information_schema'
mysql> grant select on information_schema.* to 'testuser'@'%';
ERROR 1044 (42000): Access denied for user 'root'@'localhost' to database 'information_schema'

mysql> grant select on performance_schema.* to 'testuser'@'%';
Query OK, 0 rows affected (0.00 sec)

mysql> grant drop on performance_schema.* to 'testuser'@'%';
Query OK, 0 rows affected (0.00 sec)

mysql> grant drop on information_schema.* to 'testuser'@'%';
ERROR 1044 (42000): Access denied for user 'root'@'localhost' to database 'information_schema'

解决:

单独为新用户授权单一权限。例如

 

 

结论:

information_schema所有用户默认就有权限,相当于oracle的user_*视图,目测不支持(也无需)显示授权,包括select。

performance_schema默认等同于普通db,唯一的区别在于不支持all权限,需要显示授予select/drop等权限(要truncate必须有drop权限)。

本文标签: mysqlperformanceschemainformationschema