查看mysql数据库所有用户的权限
mysql> SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;
+----------------------------+
| query |
+----------------------------+
| User: 'root'@'127.0.0.1'; |
| User: 'demo'@'127.0.0.1'; |
| User: 'root'@'::1'; |
| User: 'root'@'localhost'; |
+----------------------------+
4 rows in set (0.00 sec)
查看mysql数据库中某个用户的权限
mysql> show grants for 'demo'@'127.0.0.1';
+---------------------------------------------------------------------------------------------------------------+
| Grants for demo@127.0.0.1 |
+---------------------------------------------------------------------------------------------------------------+
| GRANT SELECT ON *.* TO 'demo'@'127.0.0.1' IDENTIFIED BY PASSWORD '*183D4A719E6666E5809CFEBC2664C5B7255DB14D' |
+---------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)