Note
- This view is available starting with V4.3.1 in V4.3.x.
- This view is available starting with V4.2.3 in V4.2.x.
Purpose
The mysql.role_edges view displays the grant relationships between roles and users.
Columns
| Column | Type | Nullable | Description |
|---|---|---|---|
| FROM_HOST | varchar(255) | NO | The host name of the account to which the role is granted. |
| FROM_USER | varchar(128) | NO | The account name to which the role is granted. |
| TO_HOST | varchar(255) | NO | The host name of the account that receives the grant. |
| TO_USER | varchar(128) | NO | The account name that receives the grant. |
| WITH_ADMIN_OPTION | varchar(1) | NO | Indicates whether the grant includes the ADMIN option. |
Sample query
Query the grant relationship between the role role1 and the user user001.
Create the role
role1.obclient [oceanbase]> CREATE ROLE IF NOT EXISTS role1; Query OK, 0 rows affected, 1 warningGrant the
ALTER SYSTEMprivilege to the rolerole1.obclient [oceanbase]> GRANT ALTER SYSTEM ON *.* TO role1;Create the user
user001.obclient [oceanbase]> CREATE USER 'user001'@'%' IDENTIFIED BY '******';Grant the role
role1to the newly created useruser001.obclient [oceanbase]>GRANT role001 TO user001 WITH ADMIN OPTION;;Query the grant relationship between the role
role1and the useruser001.obclient > SELECT * FROM mysql.role_edges;The query result is as follows:
+-----------+-----------+---------+---------+-------------------+ | FROM_HOST | FROM_USER | TO_HOST | TO_USER | WITH_ADMIN_OPTION | +-----------+-----------+---------+---------+-------------------+ | % | role001 | % | user001 | Y | +-----------+-----------+---------+---------+-------------------+ 1 row in set
References
For more information about the roles enabled by default for a user, see mysql.default_roles.
For more information about the operations and descriptions of user roles, see View roles.