Skip to content

Instantly share code, notes, and snippets.

@gobinathm
Created March 9, 2017 00:48
Show Gist options
  • Select an option

  • Save gobinathm/75be9cdcf775eed562f3f75355508ab4 to your computer and use it in GitHub Desktop.

Select an option

Save gobinathm/75be9cdcf775eed562f3f75355508ab4 to your computer and use it in GitHub Desktop.
Retrive Lost MySql Root Password in Mac / Linux
  • Stop MySQL:
sudo /usr/local/mysql/support-files/mysql.server stop
  • Next Step would be to start it in safe mode:
sudo mysqld_safe --skip-grant-tables
  • Execute the following commands in order
  • mysql -u root
  • FLUSH PRIVILEGES;
  • ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';. Please ensure you change MyNewPass to what ever you want.
  • Now exit mysql prompt
  • Start MySQL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment