Double MySQL Running on Mountain Lion
- by Norris
After I've done a full restart, my Apache PHP server doesn't connect to Local MySQL ( connecting via 127.0.0.1 because localhost for some reason fails always ).
So I did this today:
? ~ mysqladmin shutdown -u root -p
Enter password:
? ~ mysqladmin shutdown -u root -p
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!
Which basically means that I succeeded in shutting down mysql. But as soon as I did - Apache PHP successfully connect to MySQL and my local sites work without a hiccup until the next restart.
Here are a few other details:
(as you can tell - I've installed MySQL via brew)
? ~ sudo ps aux | grep mysql
N 4774 0.0 0.0 2432768 620 s000 S+ 9:53AM 0:00.00 grep mysql
N 4772 0.0 2.6 3030168 440688 ?? S 9:51AM 0:00.29 /usr/local/Cellar/mysql/5.6.13/bin/mysqld --basedir=/usr/local/Cellar/mysql/5.6.13 --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/Cellar/mysql/5.6.13/lib/plugin --bind-address=127.0.0.1 --log-error=/usr/local/var/mysql/N.local.err --pid-file=/usr/local/var/mysql/N.local.pid
N 4686 0.0 0.0 2433432 1000 ?? S 9:51AM 0:00.01 /bin/sh /usr/local/opt/mysql/bin/mysqld_safe --bind-address=127.0.0.1
N 4362 0.0 2.7 3120276 458728 ?? S 9:47AM 0:00.45 mysqld
? ~ lsof -i | grep mysql
mysqld 4362 N 16u IPv6 0x76959e40691f9f93 0t0 TCP *:mysql (LISTEN)
This is the weird thing:
? ~ killall -9 mysqld
MySQL Is dead! Apache doesn't connect. Then, when I run:
? ~ sudo mysqladmin shutdown -u root -p
Enter password:
Apache is (again) able to successfully connect to MySQL.
As far as I understand this means that I have two mysql servers setup and both of them are trying to start up at the same time, but I don't have the slightest idea on how to fix it. I've tried brew reinstalling but that didn't help.
? ~ which mysqladmin
/usr/local/bin/mysqladmin
? ~ whence -p mysql
/usr/local/bin/mysql