RENAME USER
Description
This statement is used to modify the username of a login user in seekdb.
info
You must have the global CREATE USER privilege to use this command to rename a user.
Syntax
RENAME USER
'old_user_name' TO 'new_user_name'
[,'old_user_name' TO 'new_user_name'...];
Parameters
| Parameter | Description |
|---|---|
| old_user_name | The original username. |
| new_user_name | The new username. The username must be less than or equal to 16 bytes. |
| 'old_user_name' TO 'new_user_name' | The username to be modified. When modifying multiple usernames, separate them with commas (,). The permissions of the new and old users remain consistent before and after the modification. |
Examples
-
Before the modification, execute the following command to view the user.
The result is as follows:
SELECT user FROM mysql.user;
+-----------+
| user |
+-----------+
| root |
| admin |
| sqluser01 |
| sqluser02 |
+-----------+
4 rows in set (0.012 sec) -
Execute the following command to rename the username of the
sqluser01user toobsqluser01.RENAME USER 'sqluser01' TO 'obsqluser01'; -
After the modification, execute the following command to view the user. The result is as follows:
The username of the
sqluser01user is changed toobsqluser01.RENAME USER 'sqluser01' TO 'obsqluser01';
Query OK, 0 rows affected (0.131 sec)
SELECT user FROM mysql.user;
+-------------+
| user |
+-------------+
| root |
| admin |
| obsqluser01 |
| sqluser02 |
+-------------+
4 rows in set (0.033 sec)