格式:
show grants;
示例:
mysql> show grants;
+---------------------------------------------------------------------+
| Grants for root@localhost |
+---------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION |
+---------------------------------------------------------------------+
1 row in set (0.00 sec)
查看某个用户的权限:
mysql> show grants for 'pig';
+-----------------------------------------------------+
| Grants for pig@% |
+-----------------------------------------------------+
| GRANT USAGE ON *.* TO 'pig'@'%' |
| GRANT SELECT, INSERT ON `mysql`.`user` TO 'pig'@'%' |
+-----------------------------------------------------+
2 rows in set (0.00 sec)