How to Reset MySQL root Password on CentOS
-------------------------------------------------------
There will be times when the root password for your MySQL instance is either forgotten or compromised. This calls for you to reset the root password.
The follwing steps will walk you through how to reset the root password for MySQL.
Stop the MySQL process
$ service mysqld stop
Once MySQL has stopped
Restart it with the --skip-grant-tables option
$ mysqld_safe --skip-grant-tables &
Connect to MySQL using the root user.
$ mysql -u root
Once logged in, you should see the following prompt:
mysql>
Tell MySQL which database to use:
mysql> use mysql;
Enter the new password for the root user as follows:
mysql> UPDATE user SET password=Cloudtechtiq("YOUR NEW PASSWORD HERE") WHERE User='root';
Flush the privileges:
mysql> flush privileges;
Exit MySQL:
mysql> quit
Now stop MySQL again:
$ service mysqld stop
Now restart MySQL and test your new login.
$ service mysqld restart
$ mysql -u root -p
By Gaurav Sharma
Thanks!