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 role account that is granted the privilege. |
| FROM_USER | varchar(128) | NO | The name of the role account that is granted the privilege. |
| TO_HOST | varchar(255) | NO | The host name of the account that receives the privilege. |
| TO_USER | varchar(128) | NO | The name of the account that receives the privilege. |
| WITH_ADMIN_OPTION | varchar(1) | NO | Indicates whether the privilege granted to the role includes the ADMIN option. |
Sample query
Query the grant relationship between the role1 role and the user001 user.
Create the
role1role.obclient [oceanbase]> CREATE ROLE IF NOT EXISTS role1; Query OK, 0 rows affected, 1 warningGrant the
ALTER SYSTEMprivilege to therole1role.obclient [oceanbase]> GRANT ALTER SYSTEM ON *.* TO role1;Create the
user001user.obclient [oceanbase]> CREATE USER 'user001'@'%' IDENTIFIED BY '******';Grant the
role1role to the newly createduser001user.obclient [oceanbase]>GRANT role001 TO user001 WITH ADMIN OPTION;;Query the grant relationship between the
role1role and theuser001user.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 (0.001 sec)
References
For information about the default roles enabled for a user, see mysql.default_roles.
For more information about the operations and descriptions of user roles, see View roles.