HOW TO RECOVER LOST MYSQL PASSWORD
Steps for recovering mysql password are given below:
Stop the mysql service.
#/etc/init.d/mysql stop
Once, the mysql service completely stopped, run the below.
#/usr/bin/mysqld_safe –skip-grant-tables –skip-networking &
You will be now able to login without password.
#mysql -uroot mysql
Issue the below in mysql command line.
mysql>UPDATE user SET password=PASSWORD(your new password) WHERE user=”root”; FLUSH PRIVILEGES;
mysql>exit
Stop mysql.
#/etc/init.d/mysql stop
Start MySQL again
#/etc/init.d/mysql start
That’s it! You will be now able to login with your new password.
