MySQL 5.6 显示用户的所有授权

MySQL 5.6 Show ALL Grants for User

我有一个 MySQL 对通过 VIP 进行通信。我想验证来自任何 IP 的所有用户(包括 root)的权限。当我尝试查看 root 的所有授权时,我得到了这个:

mysql> show grants for root;
ERROR 1141 (42000): There is no such grant defined for user 'root' on host '%'

但是对于 root 用户还有其他授权:

mysql> show grants for 'root'@'localhost';
+----------------------------------------------------------------------------------------------------------------------------------------+
| Grants for root@localhost                                                                                                              |
+----------------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION |
| GRANT ALL PRIVILEGES ON `*.*`.* TO 'root'@'localhost'                                                                                  |
| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION                                                                           |
+----------------------------------------------------------------------------------------------------------------------------------------+
3 rows in set (0.00 sec)

如何查看用户的所有授权(所有主机和数据库)?

你可以使用这个:

select * from INFORMATION_SCHEMA.SCHEMA_PRIVILEGES;