How to Recover a MySQL root password. Stop the MySQL server process.
Start again with no grant tables. Login to MySQL as root. Set new password. Exit MySQL and restart MySQL server
# /etc/init.d/mysql stop
# mysqld_safe –skip-grant-tables &
# mysql -u root
mysql> use mysql;
mysql> update user set password=PASSWORD(“newrootpassword”) where User=’root’;
mysql> flush privileges;
mysql> quit
# /etc/init.d/mysql stop
# /etc/init.d/mysql start