Run the following command. The ampersand (&) at the end of the command is required.
sudo mysqld_safe --skip-grant-tables &
Connect to MySQL
Run the following command:
mysql -uroot
Set a new MySQL root password
Run the following command:
use mysql;
update user set authentication_string=PASSWORD(mynewpassword) where User=\'root\';
flush privileges;
quit
Stop and start the MySQL service
service mysql restart