All Products
Search
Document Center

ApsaraDB RDS:Lock or delete an account

Last Updated:Mar 28, 2026

Lock an account to temporarily disable access without removing it, or delete an account that is no longer needed.

Prerequisites

Before you begin, make sure you have:

Lock an account

Locking an account prevents it from logging on to the RDS instance. The account and its permissions remain intact — unlock it at any time to restore access.

Important

After an account is locked, you cannot use the account to log on to your RDS instance.

  1. Go to the Instances page. In the top navigation bar, select the region where the RDS instance resides. Find the RDS instance and click the instance ID.

  2. In the left-side navigation pane, click Accounts.

  3. Find the account, click Lock in the Actions column, then click OK in the confirmation dialog. When the Status column shows Locking, the account is locked.

To restore access or remove a locked account, click Unlock or Delete in the Actions column.

Delete an account

Deleting an account is permanent and cannot be undone. Before you delete an account, check which method applies to your account type:

MethodSupported account types
ApsaraDB RDS consolePrivileged accounts and standard accounts
SQL statementsStandard accounts only
If the account has permissions on databases, tables, or other objects, deletion fails with the error Some objects depend on account. Remove all object dependencies before deleting the account.

Delete an account in the console

  1. Go to the Instances page. In the top navigation bar, select the region where the RDS instance resides. Find the RDS instance and click the instance ID.

  2. In the left-side navigation pane, click Accounts.

  3. Find the account, click Delete in the Actions column, then click OK in the confirmation dialog.

Delete a standard account using SQL

Use this method when you manage accounts through SQL or scripts.

  1. Connect to your RDS instance. For more information, see Connect to an ApsaraDB RDS for PostgreSQL instance.

  2. Transfer ownership of all objects from the account to another account:

    REASSIGN OWNED BY <The username of the account that you want to delete> TO <The username of another account>;
  3. Delete the account:

    DROP USER <The username of the account that you want to delete>;

FAQ

When I delete an account in the console, I get an `AccountActionForbidden` error saying database objects depend on the account. What should I do?

The account owns or has privileges on database objects, which blocks deletion. Identify all objects that depend on the account — such as tables, views, or schemas — and reassign or drop them first. Then retry the deletion.

What's next

  • After deletion, you can create a replacement account. For more information, see Create an account.

  • To manage accounts programmatically, use the following API operations:

    OperationDescription
    DeleteAccountDeletes an account
    LockAccountLocks an account
    UnlockAccountUnlocks an account