Watch the 7.3 Webinar On-Demand
This new release brings updates to Universal Storage, query
optimization, and usability that you won’t want to miss.
Show permissions (privileges) for the specified user (or role).
SHOW GRANTS [FOR { user | role }]
user:
'user'@'host_name'
role:
ROLE 'role_name'
'user'@'host_name'
- user for which to show privileges'role_name'
- role for which to show privilegesThe following query displays the privileges assigned to the current user.
SHOW GRANTS;
****
+---------------------------------------------------------------------+
| Grants for root@localhost |
+---------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION |
+---------------------------------------------------------------------+
1 row in set (0.00 sec)
The SHOW GRANTS FOR ROLE
command displays the grants assigned to the role specified in the query. The following query displays the grants assigned to the role ‘rw’.
SHOW GRANTS FOR ROLE 'rw';
****
+-----------------------------------------------------------------+
| Grants for role rw |
+-----------------------------------------------------------------+
| GRANT USAGE ON *.* TO ROLE 'rw' |
| GRANT SELECT, INSERT, UPDATE ON `trades`.`company` TO ROLE 'rw' |
+-----------------------------------------------------------------+
2 rows in set (12 ms)