Skip to content

Instantly share code, notes, and snippets.

@iambudi
Last active May 13, 2022 12:27
Show Gist options
  • Save iambudi/1c22b69f49703338cd8b785a45c460f2 to your computer and use it in GitHub Desktop.
Save iambudi/1c22b69f49703338cd8b785a45c460f2 to your computer and use it in GitHub Desktop.
Reset mysql root password on Mac M1
  1. Make sure mysql service stopped mysql.server stop or brew services stop mysql
  2. Create a text file somewhere ex. /Users/iambudi/reset_pass.txt and write this one liner sql to the file:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'ReplaceNewPassHere';
  1. Run mysql service mysqld --init-file=/Users/iambudi/reset_pass.txt
  2. Connect to mysql using the new password

When things goes okay, delete the reset_pass.txt, stop and start mysql again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment