After running Mac OS X updates this morning when I run PHP projects on my local machine, when they were fine last night are now giving me errors:
mysql_connect() [function.mysql-connect]: [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) [CORE/cake/libs/model/datasources/dbo/dbo_mysql.php, line 540]
Has anyone had a similar problem?
Jonesy
From apple support forum : http://discussions.apple.com/thread.jspa?messageID=12176949
I had the same problem and fixed it by editing my php.ini file:
In Terminal type sudo nano /etc/php.ini (Terminal will ask you for your password)
Change: mysql.default_socket = to: mysql.default_socket = /tmp/mysql.sock
Press Ctrl-O, then Enter to save
Still in Terminal, type sudo apachectl graceful
That's it!
It appears that MySQL is no longer running. How did you install MySQL? Does it report any error when you try to start/restart it?
you can start the mysqld deamon pointing to any socket file that you want. You just have to say to the client as well which file you want to use.
In your case i would:
you can try to start your deamon using a socket file like:
and then with your mysqlclient you can do something like
it will work