| 用途 | 权限审计 |
|---|---|
| 系统表 | mysql.user / mysql.db / mysql.tables_priv / mysql.role_edges |
| 首选 | SHOW GRANTS / information_schema |
常用审计查询
常用审计查询
SELECT user, host, account_locked, plugin FROM mysql.user;
SELECT * FROM mysql.role_edges;
SELECT grantee, table_schema, privilege_type FROM information_schema.table_privileges WHERE grantee LIKE '%app%' LIMIT 20;不要直接 DML 修改 mysql 系统表(8.0 数据字典已不推荐),账号与权限一律走 CREATE/GRANT/REVOKE 语句。