All Products
Search
Document Center

AnalyticDB:RENAME USER

Last Updated:Mar 28, 2026

Renames one or more database accounts.

Syntax

RENAME USER old_user TO new_user
    [, old_user TO new_user] ...

Parameters

ParameterDescription
old_userThe existing account name to rename.
new_userThe new account name.

To rename multiple accounts in a single statement, separate each rename pair with a comma.

Example

The following example renames account2 to account_2, then verifies the rename by querying the mysql.user system table.

-- Rename the account
RENAME USER account2 TO account_2;

-- Verify the rename
SELECT User, Host, Password FROM mysql.user;

Expected output:

+----------+-----+-------------------------+
| User     | Host| Password                |
+----------+-----+-------------------------+
| account2 | %   | *61f3777f02386598cda**** |
| account_2| %   | *0fe79c07e168cabc99b**** |
+----------+-----+-------------------------+