Recently I came across a very strange issue on my MAC OSX Catalina 10.15.0 where MySQL server wouldn't start. I've tried so many options and solutions but failed every single time. What i investigated while solving the fix for this issues as it seems like some sort of a conflict between the old MySQL versions.

In this short article, we’ll go through the commands to fix this issues.

What we’ve done is used brew’s remove & cleanup commands, unloaded the launchctl script, then deleted the mysql directory in /usr/local/var, deleted my existing /etc/my.cnf and launchctl plist

Take Databases Dumps

Its always a better practice to take your Databases dumps before removing any of mySQL files.

mysqldump -uroot -p --all-databases ~/alldatabases.sql

Removing MySQL

brew remove mysql
brew cleanup
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

Please note that your plist will be based on the version of mySQL you’ve used.

rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
sudo rm -rf /usr/local/var/mysql

Reinstall MySQL

Now we’ll try to reinstall MySQL using Homebrew

brew install mysql

Start the server to able to log on to it

mysql.server start

For mysql_secure_installation, use the alternative script and follow the instructions and set your secure password

/usr/local/Cellar/mysql/8.0.18_1/bin/mysql_secure_installation

Launchctl libraries

Followed the launchctl section from the brew package script output such as

To Start launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

To Stop launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

Boom!

Your MySQL must be back up now and ready to go. Hope this helps.

You may also Like