30.4 查看用户权限
MySQL中可以使用SHOW GRANTS FOR语句查看用户权限,可以通过查询mysql数据库下的user数据表查看用户的权限,也可以通过查询information_schema数据库查看用户的权限。
30.4.1 通过SHOW GRANTS FOR语句查看用户权限
例如,查看binghe用户的权限。
mysql> SHOW GRANTS FOR binghe@localhost \G
*************************** 1. row ***************************
Grants for binghe@localhost: GRANT USAGE ON *.* TO 'binghe'@'localhost'
*************************** 2. row ***************************
Grants for binghe@localhost: GRANT SELECT, INSERT, UPDATE, DELETE ON `goods`.* TO 'binghe'@'localhost' WITH GRANT OPTION
2 rows in set (0.00 sec)