MySQL Root Password Reset

How to quickly reset a server’s MySQL password

By Robin Rowe

HOLLYWOOD, CA (LinuxMovies) 2015/10/18 – Forgot your password to MySQL? Login to your server as root then issue these commands to change it…

service mysql stop
mysqld_safe --skip-grant-tables &
mysql -u root
mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit
/etc/init.d/mysql stop
service mysql start
mysql -u root -p

Note that service stop won’t kill mysqld_safe, that you have to stop it as shown above.

Leave a Reply

Your email address will not be published. Required fields are marked *