Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL 5.6 Show ALL Grants for User

I have a MySQL pair that communicates over a VIP. I want to verify permissions for all users (including root) from ANY IP. When I attempt to view all grants for root I get this:

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

But there are other grants for 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)

How can I view ALL grants for a user (all hosts and databases)?

like image 669
Ken J Avatar asked Feb 04 '26 00:02

Ken J


1 Answers

You can use this:

select * from INFORMATION_SCHEMA.SCHEMA_PRIVILEGES;
like image 196
DecoderReloaded Avatar answered Feb 05 '26 20:02

DecoderReloaded



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!