Rename user in MySQL database

Rename user account in MySQL database

RENAME USER old_user TO new_user
    [, old_user TO new_user] ...

Example of Rename User in MySQL

RENAME USER 'hr'@'localhost' TO 'salesuser'@'';

--Rename multiple user
    hr@localhost TO salesuser@localhost,
    scott@localhost TO orderuser@localhost;

Check the User present in MySQL

SELECT host, user
FROM mysql.user
WHERE user = 'salesuser' and host = 'localhost';

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.