Purpose
This statement is used to delete an OceanBase Database user.
Note
- You must have the
CREATE USERsystem privilege to use theDROP USERcommand. - The
CASCADEoption specifies whether to delete all objects owned by the user, including privileges, databases, tables, etc., before deleting the user.
Syntax
DROP USER user_name [, user_name ...] [CASCADE]
Parameters
| Parameter | Description |
|---|---|
| user_name | Specifies the username to be deleted:
|
| CASCADE | Optional parameter, specifies whether to cascade delete all objects owned by the user:
|
Examples
Drop a single user:
obclient> DROP USER user1;Drop a user from a specified host:
obclient> DROP USER 'user1'@'localhost';Drop multiple users:
obclient> DROP USER user1, user2@'%', 'user3'@'localhost';Drop a user and cascade delete its objects:
obclient> DROP USER user1 CASCADE;
