TiDBTiDB Docs Dash 2024

Jan 9 - Jan 12 (UTC)
Join us to improve docs and win a prize!
Sign InTry Free

RENAME USER

RANAME USER is used to rename an existing user.

Synopsis

RenameUserStmt
RENAMEUSERUserToUser,
UserToUser
UsernameTOUsername
Username
StringName@StringNamesingleAtIdentifierCURRENT_USEROptionalBraces

Examples

CREATE USER 'newuser' IDENTIFIED BY 'mypassword';
Query OK, 1 row affected (0.02 sec)
SHOW GRANTS FOR 'newuser';
+-------------------------------------+ | Grants for newuser@% | +-------------------------------------+ | GRANT USAGE ON *.* TO 'newuser'@'%' | +-------------------------------------+ 1 row in set (0.00 sec)
RENAME USER 'newuser' TO 'testuser';
Query OK, 0 rows affected (0.08 sec)
SHOW GRANTS FOR 'testuser';
+--------------------------------------+ | Grants for testuser@% | +--------------------------------------+ | GRANT USAGE ON *.* TO 'testuser'@'%' | +--------------------------------------+ 1 row in set (0.00 sec)
SHOW GRANTS FOR 'newuser';
ERROR 1141 (42000): There is no such grant defined for user 'newuser' on host '%'

MySQL compatibility

RENAME USER is expected to be fully compatible with MySQL. If you find any compatibility difference, you can report a bug.

See also

Was this page helpful?

Download PDFRequest docs changesAsk questions on Discord
Playground
New
One-stop & interactive experience of TiDB's capabilities WITHOUT registration.
Products
TiDB
TiDB Dedicated
TiDB Serverless
Pricing
Get Demo
Get Started
© 2024 PingCAP. All Rights Reserved.
Privacy Policy.