This MariaDB tutorial explains how to use the MariaDB RENAME USER statement with syntax and examples.
The RENAME USER statement is used to rename a user in the MariaDB database.
The syntax for the RENAME USER statement in MariaDB is:
user_name TO new_name;
Parameters or Arguments
The name of the user to rename in the MariaDB database.
The new name to assign to the user.
Let's look at how to rename a user in MariaDB using the RENAME USER statement.
'fastread.aitechtonic'@'localhost' TO 'totn'@'localhost';
In this example, the RENAME USER statement would rename the user called fastread.aitechtonic 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.
'fastread.aitechtonic'@'localhost' TO 'totn'@'localhost',
'checkyourmath'@'localhost' TO 'cym'@'localhost';
This RENAME USER example would rename two users in MariaDB. The first user called fastread.aitechtonic would be renamed to totn and the second user called checkyourmath would be renamed to cym.