SingleStore DB

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. If a hostname is not specified, @'%' will be appended to the user string. For example, 'demo-user' is equivalent to 'demo-user'@'%'.The '%' wildcard matches any hostname. user and host_name need not be quoted if they are legal as unquoted identifiers. Quotes must be used if a host_name string contains wildcard characters (such as %), or a user string contains special characters (such as space or -) or is a restricted keyword.

  • 'role_name' - role for which to show privileges

Remarks
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)