$ brew uninstall mysql
$ brew doctor
$ brew prune
$ brew cleanup
Search if mysql is currently running in background:
$ ps -ax | grep mysql
- stop and
kill
any MySQL processes
$ sudo rm /usr/local/mysql
$ sudo rm -rf /usr/local/var/mysql
$ sudo rm -rf /usr/local/mysql*
$ sudo rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
$ sudo rm -rf /Library/StartupItems/MySQLCOM
$ sudo rm -rf /Library/PreferencePanes/My*
$ launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
- edit
$ /etc/hostconfig
and remove the lineMYSQLCOM=-YES-
$ rm -rf ~/Library/PreferencePanes/My*
$ sudo rm -rf /Library/Receipts/mysql*
$ sudo rm -rf /Library/Receipts/MySQL*
$ sudo rm -rf /private/var/db/receipts/*mysql*
$ mysql
(it shouldn't work)
$ brew install mysql
$ brew services start mysql
$ ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
-
$ brew list mysql
-
$ cp /brew_path_of_mysql_my_cnf_file/my.cnf /etc/my.cnf
-
i.e
$ cp /usr/local/Cellar/mysql/8.0.12/.bottle/etc/my.cnf /etc/my.cnf
in section [mysqld]
add line:
default-authentication-plugin=mysql_native_password
$ mysql -u root -p
$ ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YOUR_PASSWORD_HERE';
$ GRANT ALL PRIVILEGES ON * . * TO 'root'@'localhost';
$ FLUSH PRIVILEGES;
$ exit
from mysql terminal and close and restart the terminal
$ brew services restart mysql
REF: https://stackoverflow.com/questions/51179516/sequel-pro-and-mysql-connection-failed