Skip to content

Instantly share code, notes, and snippets.

@asquare14
Last active May 27, 2019 07:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save asquare14/7750f01d6b7c6017b9770be6858d1294 to your computer and use it in GitHub Desktop.
Save asquare14/7750f01d6b7c6017b9770be6858d1294 to your computer and use it in GitHub Desktop.
Reset your MySQL password on MacOS
  • Stop the mysql service.

    $ brew services stop mysql

  • Kill all mysql processes

    $ pkill mysqld

  • This will delete ALL your existing database !

    $ rm -rf /usr/local/var/mysql/ # NOTE: this will delete your existing database!!!

  • Install mysql and restart the service.

    $ brew postinstall mysql

    $ brew services restart mysql

  • Go into the mysql commandline.

    $ mysql -uroot

  • Then change the mysql password .

    SET PASSWORD FOR root = 'mysql';

  • Then FLUSH PRIVILEGES; and exit;.

Here are some reference links for your help.

https://stackoverflow.com/questions/9695362/macosx-homebrew-mysql-root-password/18439812

https://stackoverflow.com/questions/50177216/how-to-grant-all-privileges-to-root-user-in-mysql-8-0?rq=1

@harshit98
Copy link

This looks great and helpful. 🎉

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