tags:

views:

52

answers:

1

I just installed mysql-5.1.51-osx10.6-x86_64 and I'm having issues. Also installed MySQL.prefPane and MySQLStartupItem.pkg. Lastly I added MySQL to $PATH

$echo $PATH
$/usr/local/mysql/bin

now when if I:

 $ sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
 $ Password: 
 $ mysql
 $ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

If I start MySQL from the prefPain and go back to the command line and type mysql and then everything works. I can login and create databases and all that. But if I try to access my DB from php I get a similar type of error:

No such file or directory (trying to connect via unix:///var/mysql/mysql.sock)

Anyone know how I might fix this? Thanks in advance.

A: 

Ok I fixed the problem. PHP was looking for mysql.sock in /var/mysql/ but it is actually located in /tmp/ so I created a symlink

$ sudo ln -s /tmp /var/mysql

...and now it's working fine. If anyone can expound on this -- what is mysql.sock, why is it in the wrong directory, better ways to handle the problem -- it would be much appreciated.

Thanks

jwerre