[MDEV-14708] SHOW EVENTS in performance_schema gives Access Denied Created: 2017-12-19  Updated: 2017-12-19  Resolved: 2017-12-19

Status: Closed
Project: MariaDB Server
Component/s: Authentication and Privilege System, Events
Affects Version/s: 5.5, 10.0, 10.1, 10.2
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Karl Håkansson Assignee: Sergei Golubchik
Resolution: Not a Bug Votes: 0
Labels: upstream-fixed
Environment:

rhel 7



 Description   

Description:
Executing SHOW EVENTS on performance_schema returns an Access denied error, even if the user is root.
Perhaps the command should return an empty result set instead.

How to repeat:

MariaDB [(none)]> use performance_schema;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
 
Database changed
MariaDB [performance_schema]> show grants;
+----------------------------------------------------------------------------------------------------------------------------------------+
| Grants for root@localhost                                                                                                              |
+----------------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*****************************************' WITH GRANT OPTION |
| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION                                                                           |
+----------------------------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)
 
MariaDB [performance_schema]> show events;
ERROR 1044 (42000): Access denied for user 'root'@'localhost' to database 'performance_schema'



 Comments   
Comment by Elena Stepanova [ 2017-12-19 ]

Thanks for the report.

Reproducible on all of MariaDB 5.5-10.3, MySQL 5.5-5.6. Not reproducible on MySQL 5.7, apparently fixed in scope of https://bugs.mysql.com/bug.php?id=73082.

Comment by Sergei Golubchik [ 2017-12-19 ]

This is not a bug. One of the differences between SHOW commands and queries on information_schema tables — SHOW commands check privileges up front and fail with an error, while information_schema tables only omit rows, presenting an empty result set. For example:

MariaDB [test]> show tables from mysql;
ERROR 1044 (42000): Access denied for user 'mysqltest_1'@'localhost' to database 'mysql'
MariaDB [test]> select * from information_schema.tables where table_schema='mysql';
Empty set (0.00 sec)

One needs to have EVENT privilege to see events. Nobody has this privilege on performance_schema, not even the root user. So SHOW EVENTS rightfully fails there. And informartion_schema.events displays no rows (rightfully, too).

Generated at Thu Feb 08 08:15:39 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.