Tuesday, April 19, 2011

How to reset user password in mysql in redhat or centos linux


Resetting the mysql user password in safemode. Lets see how to reset the password of root user in Centos / redhat linux.

Step1 : Stop the mysql service

#/etc/init.d/mysqld stop

step2 : Enter mysql safemode

#mysqld_safe --skip-grant-tables &

Step3 : Change the password

mysql> update mysql.user set password=PASSWORD("NEWPASSWORD") where User='root';

Step4 : Flush the privileges

mysql> flush privileges;

Step5 : Its over. Now you can quit.

mysql> quit

Step6 : Start the mysql service

#/etc/init.d/mysqld start

Step7 : Restart the mysql service to confirm that the safemode has been exsited.

#/etc/init.d/mysqld restart

No comments:

Post a Comment

Be nice. That's all.