This are the steps:
# service mysqld stop
# mysqld_safe --skip-grant-tables &
# mysql --user=root mysql
MYSQL> update user set Password=PASSWORD('new-password') where user='root';
MYSQL> flush privileges;
MYSQL> exit;
# service mysqld restart
This is the source.