To reset MySQL root password on your VPS server or dedicated server you need to follow step-by-step tutorial.
1. Stop mysql:
/etc/init.d/mysql stop
2. Run in the mode without checking the access rights:
/usr/bin/mysqld_safe --skip-grant-tables --user=root &
3. Connect as root without the password:
mysql -u root
4. Choose an active database:
mysql use mysql;
5. Renew the password:
update user set Password=PASSWORD('newpwd') WHERE User='root';
newpwd – type your new password.
6. Apply the changes:
flush privileges;
7. Exit MySQL:
quit;
8. Reboot MySQL server:
/etc/init.d/mysql restart
You had changed MySQL root password successfully.