Resetting lost MySQL root password in Mac OS

If you have installed MySQL on your Mac and forgot your root password, these instructions are for you.

sudo /usr/local/mysql/support-files/mysql.server stop
sudo /usr/local/mysql/support-files/mysql.server start --skip-grant-tables
/usr/local/mysql/support-files/mysql
mysql> flush privileges;
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'NEWPASS';
mysql> quit
sudo /usr/local/mysql/support-files/mysql.server restart
/usr/local/mysql/support-files/mysql -u root -pNEWPASS

Just replace the NEWPASS with your new password. Also, I don't recommend typing the password in the commandline as I did in the last line if you are on a Mac Server.

Technologies: 
Actions: