Bug #112468 EXPLAIN CONNECTION FOR not working with process privilege
Submitted: 26 Sep 2023 9:22 Modified: 28 Sep 2023 10:20
Reporter: ANIL JOSHI Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any

[26 Sep 2023 9:22] ANIL JOSHI
Description:
Hi, I am getting "Access denied for user 'monuser'@'%'" while doing "explain for connection 19;".

The required set of privileges seems fine. Moreover the documentation:- https://dev.mysql.com/doc/refman/8.0/en/explain-for-connection.html doesn't clearly specifies exactly what other privileges are required other than the "PROCESS".

mysql> show grants for  `monuser`@`%`;
+--------------------------------------------------------------------------+
| Grants for monuser@%                                                     |
+--------------------------------------------------------------------------+
| GRANT SELECT, PROCESS, SUPER, REPLICATION CLIENT ON *.* TO `monuser`@`%` |
+--------------------------------------------------------------------------+
1 row in set (0.00 sec)

How to repeat:
Session1:

mysql> select * from Employee;select sleep (30);

Session2:

mysql> show processlist;
+----+-----------------+-----------+--------+---------+-------+------------------------+------------------+
| Id | User            | Host      | db     | Command | Time  | State                  | Info             |
+----+-----------------+-----------+--------+---------+-------+------------------------+------------------+
|  5 | event_scheduler | localhost | NULL   | Daemon  | 15867 | Waiting on empty queue | NULL             |
| 14 | root            | localhost | NULL   | Sleep   |  1523 |                        | NULL             |
| 19 | root            | localhost | sbtest | Query   |     2 | User sleep             | select sleep(30) |
| 21 | monuser         | localhost | NULL   | Query   |     0 | init                   | show processlist |
+----+-----------------+-----------+--------+---------+-------+------------------------+------------------+
4 rows in set (0.01 sec)

mysql> explain for connection 19;
ERROR 1045 (28000): Access denied for user 'monuser'@'%' (using password: YES)

Suggested fix:

Its working fine when provided a full set of access.

Example

GRANT all privileges on *.* to `monuser`@`%`;
[28 Sep 2023 10:20] MySQL Verification Team
Hi Mr. Joshi,

Thank you for your bug report.

We reproduced your test case.

Problem is indeed in the documentation, because you can not view EXPLAIN for the connection that is run by user having all privileges.

Verified as a documentation bug.