Article by Aashish
This article explains the process that will allow you to recover a lost MySQL password:
Stop the MySQL server process
Start the MySQL (mysqld) server/daemon process with the
–skip-grant-tables option so that it will not prompt for password.
Connect to mysql server as the root user.
Setup new mysql root account password.
Exit and restart the MySQL server.
Example:
# service mysqld stop
Output:
Stopping MySQL database server: mysqld.
Then start MySql in safe mode
# mysqld_safe –skip-grant-tables
Output
[1] 5988
Starting mysqld daemon with databases from /var/lib/mysql
Then connect the mysql without any password
# mysql -u root
( Then setup password )
mysql> use mysql;
mysql> update user set password=PASSWORD(”NEW-ROOT-PASSWORD”) where User=’root’;
mysql> flush privileges;
mysql> quit
Then stop mysql
# service mysql stop
# service mysql start
Then Try your new password :
# mysql -u root -p
Good Luck!