-
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;
andexit;
.
Here are some reference links for your help.
https://stackoverflow.com/questions/9695362/macosx-homebrew-mysql-root-password/18439812