first stop mysql service and start mysql in safe mode using the following command
service mysqld stop
mysqld_safe --skip-grant-tables &
now connetc to mysql using the following command
mysql enter(return character)
mysql> use mysql
mysql> update user set Password=PASSWORD('passw0rd') where user='root';
mysql> flush privileges;
mysql> exit;
now password has be reset. kill mysqld_safe deamon and start mysql service using the following command
service mysqld start
now you can enter to mysql console using the new password
service mysqld stop
mysqld_safe --skip-grant-tables &
now connetc to mysql using the following command
mysql enter(return character)
mysql> use mysql
mysql> update user set Password=PASSWORD('passw0rd') where user='root';
mysql> flush privileges;
mysql> exit;
now password has be reset. kill mysqld_safe deamon and start mysql service using the following command
service mysqld start
now you can enter to mysql console using the new password