MariaDB: RENAME USER statement
This MariaDB tutorial explains how to use the MariaDB RENAME USER statement with syntax and examples.
Description
The RENAME USER statement is used to rename a user in the MariaDB database.
Syntax
The syntax for the RENAME USER statement in MariaDB is:
RENAME USER user_name TO new_name;
Parameters or Arguments
- user_name
- The name of the user to rename in the MariaDB database.
- new_name
- The new name to assign to the user.
Example
Let's look at how to rename a user in MariaDB using the RENAME USER statement.
For example:
RENAME USER 'techonthenet'@'localhost' TO 'totn'@'localhost';
In this example, the RENAME USER statement would rename the user called techonthenet to totn in the MariaDB database.
Rename more than one user
How can you rename more than one user at a time in MariaDB? You can use the RENAME USER statement to rename multiple users by comma separating the user name values.
For example:
RENAME USER 'techonthenet'@'localhost' TO 'totn'@'localhost', 'checkyourmath'@'localhost' TO 'cym'@'localhost';
This RENAME USER example would rename two users in MariaDB. The first user called techonthenet would be renamed to totn and the second user called checkyourmath would be renamed to cym.
Advertisements