Purpose
This statement is used to drop a role.
Limitations and considerations
- When dropping a role, the system automatically revokes the role from all users and roles that have been granted the role and removes it from the database.
- Roles specified in the
mandatory_rolessystem variable cannot be dropped. - When dropping multiple roles at once, if any one of the roles cannot be successfully dropped, the entire operation will be rolled back, and none of the roles will be dropped.
Privilege requirements
To drop a role, the current user must have the CREATE USER or DROP ROLE privilege. For more information about OceanBase Database privileges, see Privilege classification in MySQL mode.
Syntax
DROP ROLE role_name [, role_name ...];
Parameters
| Parameter | Description |
|---|---|
| role_name | The name of the role to be dropped. When dropping multiple roles, separate the role names with commas (,). |
Examples
Drop the role001 role.
DROP ROLE role001;
