In OSX Snow Leopard, you may be seeing errors like these:
Warning: PDO::__construct(): [2002] No such file or directory
(trying to connect via unix:///var/mysql/mysql.sock)
in /Users/john/src/php/dbtest.php on line 5
Failed: SQLSTATE[HY000] [2002] No such file or directory
So, to correct this, first create a my.cnf file in /etc containing the following:
1 2 3 4 |
|
Then create this directory using sudo:
sudo mkdir /var/mysql
Then create a link:
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
That should fix the problem.