MySQL

MySQL Reset root Password

Every now and again a MySQL root password may have been forgotten or undocumented along the way, but that does not negate the need to access the MySQL server. There is a way to gain access to the MySQL server to change the password for root and eventually log in as root.

Applies to:
CentOS / RHEL / Scientific Linux / Oracle Linux / Fedora

Stop the MySQL service

service mysqld stop

Start MySQL in safe mode

mysqld_safe --skip-grant-tables &

Logon as root

mysql -u root

Use the MySQL database

use mysql;

Reset the password

update user set password=PASSWORD("mynewpassword") where User='root';

Flush the privileges and quit

flush privileges;
quit;

Restart

service mysqld start

Logon with new password

mysql -u root -p

Source(s)
http://www.rackspace.com/knowledge_center/article/mysql-resetting-a-lost-mysql-root-password