Reset Forgotten MySQL Root Password

Posted by Weston Ganger on October 27, 2015

I have forgotten my root password to MySQL before. This was a life saver.

It requires root access to the system obviously though.

# Start MySQL and skip the grant tables that store passwords
mysqld_safe --skip-grant-tables

# Connect to MySQL without a password
mysql --user=root mysql

# In the mysql prompt run the following commands:
UPDATE USER SET Password=PASSWORD('new_password') WHERE user='root';
flush privileges;

Then just kill your running mysqld and restart it normally.

Related External Links:

Posted in Linux and Tagged with mysql password linux 

Need help on your next project or application?

I specialize in Ruby-on-Rails, AngularJS, Javascript, Bootstrap, and Hybrid Mobile Apps with Cordova & Ionic.

Contact Me

Recommended Posts