mysql performance_schema/information_schema授权问题

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权限)。

原文地址:https://www.cnblogs.com/zhjh256/p/5779062.html