Thursday 25 July 2013

how to change mysql password for an user

Suppose you have got a user " db_user " and you have lost the password for the user. You need to reset it. For this just follow the steps bellow.

Get into the server as root, then get into mysql as root user.

#mysql -u root -p******

Where ***** should be replaced with your password for mysql root user.

Then execute the following commands.
mysql> use mysql;

mysql> SET PASSWORD FOR 'db_user'@'localhost' = PASSWORD('new-password'); 
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
           Query OK, 0 rows affected (0.00 sec)
mysql>quit
Now the password will be reset to  new-password for the user db_user.



No comments:

Post a Comment