Reset the password for the user in MySQL Server

Change the password for the user in MySQL Server

Connect with superuser root and check the user present:

mysql> select host,user from mysql.user;
+-----------+------------------+
| host      | user             |
+-----------+------------------+
| localhost | mysql.infoschema |
| localhost | mysql.session    |
| localhost | mysql.sys        |
| localhost | mysqlbackup      |
| localhost | mysqlbackup1     |
| localhost | root             |
| localhost | test             |
+-----------+------------------+
7 rows in set (0.03 sec)

Change or Reset the password with the following two commands:

mysql> ALTER USER 'test'@'localhost' identified by 'Mypassword';
Query OK, 0 rows affected (0.03 sec)

OR

mysql> set password for 'test'@'localhost'='MyPassword';
Query OK, 0 rows affected (0.08 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 )

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.