Mysql – thesql.sock problem on Mac OS X, all Zend products

mac-osxMySQLzend-server

I posted this on the Zend forum, but I'm hoping I can get a speedier reply here. I've tried every solution provided on this forum with no luck. When I restart mysql, everything appears ok.

sudo /usr/local/zend/bin/zendctl.sh restart 
Password:
/usr/local/zend/bin/apachectl stop [OK]
/usr/local/zend/bin/apachectl start [OK]
Stopping Zend Server GUI [Lighttpd] [OK]
spawn-fcgi: child spawned successfully: PID: 7943
Starting Zend Server GUI [Lighttpd] [OK]
Stopping Java bridge [OK]
Starting Java bridge [OK]
Shutting down MySQL
. SUCCESS! 
Starting MySQL
. SUCCESS! 

Pinging locahost is also OK and resolve dns to IP.

ping localhost
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.048 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.064 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.066 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.076 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.064 ms

But when I attempt to access the local url for my app, I get the dreaded:

Message: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2).

This is a show-stopper for me. I appreciate any assistance.
Thank you.

Best Answer

You can set the socket location in your application config file. If you set it for your local dev environment by adding the following line:

resources.db.params.unix_socket = /usr/local/zend/mysql/tmp/mysql.sock

No more need to link the socket by hand.