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.
Once MySQL has stopped
Restart it with the --skip-grant-tables option.
Connect to MySQL using the root user.
Once logged in, you should see the following prompt:
Tell MySQL which database to use:
Enter the new password for the root user as follows:
Flush the privileges:
Now stop MySQL again.
Now restart MySQL.
Test your new login.