Игорь Т
05/14/2026, 7:44 AMRocky
05/14/2026, 7:44 AMDROP USER command to delete them. However, StarRocks does not currently support a native RENAME USER command. To "rename" a user, you must create a new user and migrate the privileges.
1. How to Delete a User
To delete a user, use the DROP USER statement. You must have the user_admin role to perform this operation.
Syntax:
sql
DROP USER 'username'@'host';
Example:
sql
DROP USER 'jack'@'192.168.1.10';
Note: If the host is not specified, it defaults to '%'.
──────────
2. How to Rename a User (Workaround)
Since there is no RENAME USER command, you should follow these steps to effectively rename a user:
1. Check current privileges: Run SHOW GRANTS FOR 'old_user'@'host'; to see what roles and permissions the current user has.
2. Create the new user:
sql
CREATE USER 'new_user'@'host' IDENTIFIED BY 'password';
3. Grant privileges: Assign the same roles or permissions to the new user.
sql
GRANT role_name TO USER 'new_user'@'host';
-- or grant specific permissions
GRANT SELECT ON db.table TO USER 'new_user'@'host';
4. Drop the old user:
sql
DROP USER 'old_user'@'host';
Summary of Commands
Action | Command
Delete User | DROP USER 'user'@'host';
Modify Password/Roles | ALTER USER 'user'@'host' IDENTIFIED BY 'new_password';
Rename User | Not supported directly; use CREATE USER + DROP USER.
For more details on user management, you can refer to the StarRocks DROP USER documentation.
References
• sql-reference/sql-statements/account-management/DROP_USER.md
• sql-reference/sql-statements/account-management/DROP_ROLE.md
• sql-reference/sql-statements/Database/DROP_DATABASE.md
• administration/user_privs/authentication/native_authentication.md
• administration/user_privs/authorization/User_privilege.md
• sql-reference/sql-statements/account-management/REVOKE.md
• sql-reference/sql-statements/Resource/DROP_RESOURCE.md
• sql-reference/sql-statements/account-management/CREATE_USER.md