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 use the DROP USER statement to drop one or more OceanBase Database users.
The syntax is as follows:
DROP USER user_name [, user_name...];
Some notes about this:
To execute the
DROP USERstatement, you must have the globalCREATE USERprivilege.For more information about how to view your privileges, see View user privileges. If you do not have the required privilege, contact the administrator. For more information, see Modify user privileges.
You cannot use the
DELETEstatement to delete user privileges from themysql.usertable.After you drop a user, the database objects created by the user are not dropped. However, all privileges of the user are dropped.
When you drop multiple users at a time, separate the usernames with commas (,).
The following sample statement shows how to drop the sqluser02 user:
obclient> DROP USER sqluser02;
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:
The TENANT_MANAGER role is assigned to you. Otherwise, request the OceanBase Cloud Platform (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
rootorsyspassword of the tenant. For more information about the password box, 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.