This forum is no longer active. Please post your questions to our new community site
Can't connect to local MySQL server through socket
|
|
I’m running Mampstack-1.1-0 on OSX 10.5.6 Server. I’m having what seems to be a PHP->MySQL related issue. When I try to run a PHP script that normally queries a database using PDO, I’m getting the follwoing exception: Looking at a phpinfo script (running off of the mampstack apache instance and definitely pointing to the correct php for mampstack), the problem seems to be with php.ini as shown below: Under “mysql” MySQL Support: (partial) and, under Directive (master/slave): Shouldn’t the MYSQL_SOCKET be set to ”/Applications/mampstack-1.1-0/mysql/tmp/mysql.sock”? I know that ”/tmp/mysql.sock” is not valid but I’m unsure of how to change MYSQL_SOCKET for php. I’ve checked the my.cnf file in mampstack-1.1-0/mysql and all sockets are specified as ”/Applications/mampstack-1.1-0/mysql/tmp/mysql.sock”. Thanks in advance, |
|
|
My immediate solution was to create the following symlink: $ sudo ln -s /Applications/mampstack-1.1-0/mysql/tmp/mysql/mysql.sock /tmp/mysql.sock That got me connected to the database through php. This may be the boneheaded solution… I’m not sure. The symlink persists across mysql stops-starts so I’m happy. |
|
|
Hi, You can also try defining the MySQL_UNIX_PORT environment variable to /Applications/mampstack-1.1.-0/mysql/tmp/mysql.sock. I hope it helps. |

