This topic describes how to lock or delete an account from an ApsaraDB RDS for PostgreSQL instance. If your RDS instance is equipped with standard SSDs or enhanced SSDs (ESSDs), you can lock or delete an account in the ApsaraDB RDS console or by using SQL statements. If your RDS instance is equipped with local SSDs, you can delete a standard account only by using SQL statements.

Lock an account in the ApsaraDB RDS console

Before you begin, make sure that your RDS instance is equipped with standard SSDs or ESSDs.

Note After an account is locked, you cannot use the account to log on to your RDS instance.
  1. Visit the RDS instance list, select a region above, and click the target instance ID.
  2. In the left-side navigation pane, click Accounts.
  3. Find the account that you want to lock. Then, click Lock Instance in the Actions column. In the message that appears, click OK.
    Note The account requires a few minutes to be locked. When the Locking is displayed in the Status column of the account, the account is locked. If you want to use the account again, click Unlock in the Actions column.

Delete an account in the ApsaraDB RDS console

Before you perform this operation, make sure that your RDS instance is equipped with standard SSDs or ESSDs.

Note If the account that you want to delete is granted specific permissions on databases, tables, or other objects, the "Some objects depend on account" message is reported when you attempt to delete the account. You can delete the account only after you revoke the permissions that are granted to the account.
  1. Visit the RDS instance list, select a region above, and click the target instance ID.
  2. In the left-side navigation pane, click Accounts.
  3. Find the account that you want to delete. Then, click Delete in the Actions column.
  4. In the message that appears, click OK.

Delete a standard account by using SQL statements

Note
  • If the account that you want to delete is granted specific permissions on databases, tables, or other objects, the "ERROR: current user cannot be dropped" message is reported when you attempt to delete the account. You can delete the account only after you revoke the permissions that are granted to the account.
  • You can delete a standard account by using SQL statements no matter whether the RDS instance is equipped with local SSDs, standard SSDs, or ESSDs.
  1. Use Alibaba Cloud Data Management (DMS) to log on to the RDS instance. For more information, see Use DMS to log on to an ApsaraDB RDS for PostgreSQL instance.
  2. In the top navigation bar, choose SQL Console.
  3. Execute the following statement to assign the permissions of the account to another account:
    REASSIGN OWNED BY <The username of the account that you want to delete> TO <The username of another account>;
  4. Execute the following SQL statement to delete the account:
    DROP USER <The username of the account that you want to delete>;
  5. Click Execute.

Related operations

Operation Description
Delete an account Deletes an account from an ApsaraDB RDS instance.
Lock account Locks an account of an ApsaraDB RDS instance.
Unlock account Unlocks an account of an ApsaraDB RDS instance.