I have a clean install of MySQL (mysql-5.5.24-osx10.6-x86_64). I am on Lion (OS 10.7.4) with a Mac Pro Quad Core. I installed MySQL the GUI installer and also installed the
If you want to absolutely get this thing working do the following:
You need to uninstall mysql first so do that, before you do this though, make sure you have a backup of all your DBs.
brew remove mysql
Then you need to make sure certain files are uninstalled, make a batch script of the following commands and run it:
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
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*
Go to /etc/hostconfig using your favorite editing program and remove the line MYSQLCOM=-YES-
Then run brew cleanup then install mysql using brew install mysql
After you've done this you'll probably get the same error again. Head over to the folder cd /usr/local/var/mysql/. There should be a file in there called localhost.local.err
run cat ./localhost.local.err and look in the file. You should see something similar to:
2018-03-24 15:41:49 140735679804288 [ERROR] Can't start server: Bind on TCP/IP port. Got error: 48: Address already in use
2018-03-24 15:41:49 140735679804288 [ERROR] Do you already have another mysqld server running on port: 3306 ?
If you do, run the command sudo lsof -i :3306 and you'll probably get something back like this:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 74 _mysql 20u IPv6 0xXXXXXXXXXXXXX 0t0 TCP *:mysql (LISTEN)
This means mysql is already running and listening on port 3306 and you need to kill it. Use top to kill the program or just use Activity Monitor to kill it. Either way once that's done go back to cd /usr/local/var/mysql/ and delete the folder localhost.local.err.
Once that's done run mysql.server start and you should get the following:
180324 15:46:18 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
SUCCESS!
And congrats. I've been trying to fix this for a week and it's such an easy fix and I just figured it out. I hate myself.