After creating a role, you can grant the role to another role.
You can grant a role to any role other than itself, nor can you grant roles in a circular manner.
Grant a role by using an SQL statement
To grant a role to another role, you must have the ADMIN OPTION or GRANT ANY ROLE privilege and the role to be granted. For information about how to view your privileges, see View user privileges. If you do not have the required privilege, contact the administrator to obtain the privilege. For information about how to grant privileges to a user, see Modify user privileges. For information about how to view your roles, see View roles.
The SQL statement is as follows:
GRANT role_name1 TO role_name2 [WITH ADMID OPTION];
where
role_name1: specifies the name of the role to be granted to another role. When you grant multiple roles to a role at the same time, separate role names with commas (,).You can grant a role to multiple roles at the same time, or grant multiple roles to one or more roles at the same time.
WITH ADMIN OPTION: specifies that the granted role can be granted to other roles, and revoking the role does not automatically revoke the granted role from other roles.
For example, grant the role2 role to the role1 role:
obclient> GRANT role2 TO role1;
Query OK, 0 rows affected
For more information about the GRANT statement, see GRANT.