PHP & Mysql socket error
by Pascal Opitz on July 7 2007, 19:58
I keep coming across this whenever I set up MySQL and PHP on a new mac: mysql_connect() fails throwing an error …
mysql_connect() [function.mysql-connect]: Can't connect to local
MySQL server through socket '/var/mysql/mysql.sock'
And everytime I forget to remember what the solution was:
This can be fixed by changing settings in /etc/php.ini:
sudo cp /etc/php.ini.default /etc/php.ini
sudo vim /etc/php.ini
Then set the mysql default socket to the temp folder:
mysql.default_socket = /tmp/mysql.sock
Quite annoying, but then again: Hey, I’ve got a new Mac!!!
Comments
by Michel Fortin on July 7 2007, 22:22 #
by ernest leitch on July 7 2007, 22:35 #
by tom on July 8 2007, 09:15 #
by Matthias Willerich on March 10 2009, 14:22 #
by VĂctor on March 5 2009, 19:18 #