1. Stop the MySQL server.
# /etc/init.d/mysql stop
2. Start the MySQL server process with the –skip-grant-tables option so that it will not prompt for password.
# mysqld_safe –skip-grant-tables &
3. Connect to mysql server as the root.
# mysql -u root
Welcome to the MySQL monitor….
………..
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql>
4. Setup new mysql root account password i.e. reset mysql password.
mysql> use mysql;
mysql> update user set password=PASSWORD(“NEW-PASSWORD”) where User=’root’;
mysql> flush privileges;
mysql> quit
5. Exit and restart the MySQL server.
# /etc/init.d/mysql stop
6. Start MySQL server.
# /etc/init.d/mysql start
# mysql -u root -p