Outdated Version
You are viewing an older version of this section. View current production version.
SHOW GRANTS
Show permissions (privileges) for the specified user (or role).
Syntax
SHOW GRANTS FOR { user | role }
user:
'user'@'host_name'
role:
ROLE 'role_name'
Arguments
'user'@'host_name'
- user for which to show privileges'role_name'
- role for which to show privileges
Remarks
- This command can be run on any MemSQL node. For more information, see Node Requirements for MemSQL Commands.
Example
The 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)