How to reset your root MySQL password

Stop the MySQL process
# service mysqld stop

Once MySQL has stopped, restart it with the --skip-grant-tables option
# mysqld_safe --skip-grant-tables &
or edit your /etc/my.cnf file to add the line

Connect to MySQL using the root user.
mysql -u root

Once logged in, you should see the following prompt:
Enter the following commands:
mysql> use mysql;
mysql> UPDATE user SET password=PASSWORD("YOUR NEW PASSWORD HERE") WHERE User='root';
mysql> flush privileges;
mysql> quit

Now stop MySQL again:
# service mysqld stop

If you edited your /etc/my.cnf file, delelete the skip-grant-tables line.

Now restart MySQL and test your new login.
# service mysqld restart
# mysql -u root -p

This article has been provided by Codero Hosting, the leading provider of reliable
dedicated, managed and cloud hosting services. Need more information on this
topic or to learn more about Codero’s hosting services please
www.codero.comchat with us online or give us a call at 866-2-CODERO. 
Posted in
Last update:
2015-12-03 20:39
Average rating:0 (0 Votes)