开发者

Solve error an't connect to local MySQL server through socket '/usr/local/zend/mysql/tmp/mysql.sock' (2) in /Applications/MAMP/htdocs

I has problem with below error and i spent many time to solve it.

Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/usr/local/zend/mysql/tmp/mysql.sock' (2) in /开发者_如何学GoApplications/MAMP/htdocs

This this are my environment MAC OSX 10.6.5 + MAMP PRO 1.9.4 + ZendStudio

And this is solution to solve an error

  1. create folder /usr/local/zend/mysql/tmp/ (if dose not exist)
  2. use terminal and copy this : sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /usr/local/zend/mysql/tmp/mysql.sock then enter

** this error because zend can't find mysql.sock. so we need to create Alias for it.


Another solution is to edit your mysql config file. You will find two sections in there, mysqld for the server client for the client app. The socket paths must be the same.

[mysqld]
...
socket=/var/lib/mysql/mysql.sock

[client]
...
socket=/var/lib/mysql/mysql.sock
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜