---
slug: /grant-a-role-to-a-role-or-user
---

# Grant a role to a user or role

After you create a role, you can grant the role to other users or roles, but you cannot grant the role to yourself or grant the role in a cycle.

Currently, you can grant one role to multiple users or roles at a time, and you can grant multiple roles to one user or role at a time. You can also grant multiple roles to multiple users or roles at a time.

## Prerequisites

When you want to grant a role to another user or role, you must have the role and the `ADMIN OPTION` privilege to grant the role to the other user or role. For more information about how to view the privileges of the current user, see [View user privileges](../400.view-user-permissions.md).

## Examples

### Grant a role to a user

* Grant the `employee` role to the `test1` user and allow the user to grant the role to other users or roles.

    ```shell
    GRANT employee TO test1 WITH ADMIN OPTION;
    ```

    In this example, the `WITH ADMIN OPTION` clause specifies whether the current role can be granted to other roles or users.

* Grant the `employee` role to the `test1` and `test2` users at the same time.

    ```shell
    GRANT employee TO test1,test2;
    ```

* Grant the `employee` and `developer` roles to the `test1` user at the same time.

    ```shell
    GRANT employee,developer TO test1;
    ```

### Grant a role to a role

* Grant the `employee` role to the `role1` role and allow `role1` to grant the role to other roles or users.

    ```shell
    GRANT employee TO role1 WITH ADMIN OPTION;
    ```

    In this example, the `WITH ADMIN OPTION` clause specifies whether the current role can be granted to other roles or users.

* Grant the `employee` role to the `role1` and `role2` roles at the same time.

    ```shell
    GRANT employee TO role1,role2;
    ```

* Grant the `employee` and `developer` roles to the `role1` role at the same time.

    ```shell
    GRANT employee,developer TO role1;
    ```

## What to do next

After you grant a role to another user or role, the user who has the role needs to activate the role to use the privileges of the role. For more information about how to activate a role, see [Activate a role](500.activate-roles.md).

## References

For more information about the `GRANT` statement, see [GRANT](https://www.oceanbase.com/docs/common-oceanbase-database-cn-1000000002017008).