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 

Want me to help develop your next project or application?

Contact Us

Specializing in Ruby-on-Rails, Javascript, Multi-Platform Electron Desktop Apps and Hybrid Cordova Mobile Apps.

Recommended Posts