Backup the username and password in MySQL

Script for username PAssword backup in MySQL

Use of password backup is for refresh activity or need to save some time Application user password because application is configured on that password.

Note: Authentication_String is used from MySQL 5.7 upper varsion before Password is used.

SELECT CONCAT('CREATE USER \'', user, '\'@\'', host, '\' IDENTIFIED by \'', authentication_string,'\';') FROM mysql.user;

-----------+
| CREATE USER 'mysql.infoschema'@'localhost' IDENTIFIED by '$A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED'; |
| CREATE USER 'mysql.session'@'localhost' IDENTIFIED by '$A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED';    |
| CREATE USER 'mysql.sys'@'localhost' IDENTIFIED by '$A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED';        |
| CREATE USER 'mysqlbackup'@'localhost' IDENTIFIED by '$A$005$9hPgSV\hH}7]i]Avdhnu/4FWSpfRmZD4NXpZWa/N9cm2Xjslbi9N6oxKJ6';|

Use this by modified by ALTER command:

mysql> ALTER USER 'mysqlbackup'@'localhost' IDENTIFIED by '$A$005$9hPgSV\hH}7^^]i^C^V]A^Zvdhnu/4FWSpfRmZD4NXpZWa/N9cm2Xjslbi9N6oxKJ6';
Query OK, 0 rows affected (0.03 sec)

Leave a Reply

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

WordPress.com Logo

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

Google photo

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

Twitter picture

You are commenting using your Twitter 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.