Thursday, August 4, 2011

Symfony2 Install on Mac: Mysql Error – SQLSTATE[HY000] [2002] No such file or directory

I recently changed up the configuration of my Mac (running 10.6.4) and I was installing a fresh copy of Symfony2 when I ran into the following error when I got to the database credentials: SQLSTATE[HY000] [2002] No such file or directory.

I did some Googling around and came across someone that seemed to have a similar issue, though not with Magento. So I figured I’d give it a shot. Well, it worked. The unfortunate part is that, being not all too familiar with how all this configuration stuff works, I don’t know why it works (if you know why, please let me know).
The Solution

Open up your php.ini file (mine was in /etc/). Look for the following line:

pdo_mysql.default_socket=/var/mysql/mysql.sock

If that line exists for you, try changing it to:

pdo_mysql.default_socket=/tmp/mysql.sock

Restart apache after saving, and that’s all I had to do. One thing to keep in mind though is that I am using the stock php (with 10.6), and I’m using mysql installed with homebrew.

ref: http://prattski.com/2010/08/05/magento-install-mysql-error-sqlstatehy000-2002-no-such-file-or-directory/

No comments: