Reset mysql root password
1) Stop mysql server
[root@server~]# /etc/init.d/mysql.server stop
Start mysql in safe mode
 [root@server~]# /usr/local/mysql/bin/mysqld_safe –user=root –skip-grant-tables –skip-networking &
NOw the mysql will be running in the background in safe mode. You will be able to login as root by just using
 [root@server~]# mysql -u root
Once you got in you can use the following commands to reset the root password.
[root@server~]# UPDATE mysql.user SET Password=PASSWORD(‘qwert123?) WHERE User=’root’; //Here password is qwert123
[root@server~]# FLUSH PRIVILEGES;
Now just quit from the mysql prompt and try using the new password
[root@server~]# mysql -u root -p
When it ask for password, provide the new password. It will work.