You can drop a user that is no longer in use by using the DROP USER statement or in the OceanBase Cloud Platform (OCP) console.
Drop a user by using an SQL statement
You can drop a user by using the DROP USER statement. You must have the DROP USER system privilege to execute the DROP USER statement. For information about how to view your privileges, see View user privileges. If you do not have the DROP USER privilege, request the administrator to grant you the privilege. For more information, see Modify user privileges.
Notice
Dropping a user also drops all objects owned by the user, for example, privileges, databases, and tables. Proceed with caution.
The SQL statement is as follows:
DROP USER username CASCADE;
Some notes about this:
CASCADEspecifies that the system will drop all objects owned by the user, such as privileges, databases, and tables, before it drops the user.usernamespecifies the user to be dropped. Only a single user can be dropped at a time.
For example, drop a user named sqluser.
obclient> DROP USER sqluser CASCADE;
Query OK, 0 rows affected
For more information about the DROP USER statement, see DROP USER.
Drop a user in the OCP console
Prerequisites
Before you drop a user, ensure that:
You have permissions of the TENANT_MANAGER role. Otherwise, request the OCP administrator to assign the role. For more information, see "Edit a user" in the OCP User Guide of the corresponding version.
Your password box contains the password of the
sysuser under the tenant. For more information about the password box of an OCP user, see the OCP User Guide of the corresponding version.
Procedure
Log on to the OCP console.
In the left-side navigation pane, click Tenants to go to the Tenants page.
In the tenant list, find the target tenant to which the user belongs and click the tenant name. Then, the Overview page appears.
In the left-side navigation pane, click User Management.
In the user list, click Delete in the Actions column of the user that you want to drop.
In the confirmation dialog box that appears, click Delete.