To reset the root password for a MySQL instance, enter the following commands in a terminal with root/su privilages.
# /etc/init.d/mysqld stop
# mysqld_safe –skip-grant-tables &
# mysql -u root
MySQL will load. Enter the following at the prompt
mysql> use mysql;
mysql> update user set password=PASSWORD(“yourpassword”) where User=’root’;
mysql> flush privileges;
You should now be able to log in as root using the “yourpassword” that you entered.