Skip to content
Developer Edition runs on one host and does not require a product license file. Need multi-host deployment or performance testing at scale? Explore Enterprise Edition

SHOW ROLES command

The SHOW ROLES command returns information about the roles that are granted to the current user or a specific user.

The following table describes the returned columns:

Column Description
name The name of the role.
owner The owner of the role.
comment The description of the role.

Prerequisites

  • Any user can query the roles granted to themselves.
  • To query the roles granted to another user, the current user must have ADMIN.

Syntax

show_roles_command
SHOW ROLES FOR USER user_name

show_roles_command ::=
    'SHOW' 'ROLES' ('FOR' 'USER' user_name)?

Parameters

FOR

Specifies whether to query the roles granted to a specific user.

If the FOR clause is not specified, the command queries the roles granted to the current user by default.

user_name

The name of the user whose roles you want to query. To list users who have joined the current service group, use SHOW USERS.

Examples

Query the roles granted to the current user

SHOW ROLES

Return:

+-------+-------+--------------+
| name  | owner | comment      |
+-------+-------+--------------+
| ADMIN | root  | Builtin role |
+-------+-------+--------------+

Query the roles granted to a specific user

SHOW ROLES FOR USER user1
Return:

+-------+-------+-----------------------------------+
| name  | owner | comment                           |
+-------+-------+-----------------------------------+
| role1 | root  | This is new description for role1 |
+-------+-------+-----------------------------------+