Forgot the MySQL root password :

First you will have to stop the MySQL service on the server.

# service mysqld stop

Start MySQL as

# /usr/bin/safe_mysqld –skip-grant-tables &

Or

# /usr/bin/mysqld_safe –skip-grant-tables &

safe_mysqld is a script that starts mysqld and traps any forceful terminationof the MYSQL server and it privents any database corruption.

Change the password for root user as

# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD(’new_password’) WHERE user=’root’
mysql> FLUSH PRIVILEGES;

mysql> exit;

Start the MySQL service:

# service mysqld start