Overview
The mysql.role_edges view is used to display the grant relationships between roles and users.
Columns
Column |
Type |
Is NULL |
Description |
|---|---|---|---|
| FROM_HOST | varchar(255) | NO | Host Name of the Role Account |
| FROM_USER | varchar(128) | NO | Grantee role account name |
| TO_HOST | varchar(255) | NO | Recipient Account Host Name |
| TO_USER | varchar(128) | NO | Recipient Account Name |
| WITH_ADMIN_OPTION | varchar(1) | NO | Whether the role has the ADMIN privilege option |
Sample query
Query the grant relationship between role role1 and user user001.
Create a new role named
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 a new user named
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 role
role1and 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 (0.001 sec)
References
View the roles enabled by default for users: mysql.default_roles
For more information about user roles, see View roles.