Make sure You have open ssl
brew install openssl
see if you have a /etc/my.cnf
if you do, rename it to something like old.my.cnf
so that Mysql cannot find it.
I had trouble with mysql 8 and ended reverting to @5.7
I uninstalled all mysql versions following this script:
- ps -ax | grep mysql
- stop and kill any MySQL processes
- brew remove mysql
- brew cleanup
If you don't want to run the risk, rather than sudo rm
move the files to a folder such as /old/
- 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 line MYSQLCOM=-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
- restart your computer just to ensure any MySQL processes are killed
- try to run mysql, it shouldn't work
(reference: [http://soatechlab.blogspot.com/2011/01/completely-remove-mysql-on-mac-os-x.html] )
Most of my clients run mysql@5.7 so I prefer to have this version on my mac. When I need, on ocasion another version I'll use Docker for that.
To install mysql@5.7:
Install services for Brew - allows brew to controll the services:
brew tap homebrew/services
Install Mysql 5.7, link & start it
brew install mysql@5.7
brew link mysql@5.7 --force
brew services start mysql@5.7
You should have a mysql instance running.
Finally, setup your root password with:
mysqladmin -u root password 'yourpassword'