且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法在Mac上连接到MySQL-缺少mysql.sock文件

更新时间:2023-01-31 07:41:46

首先,我建议您使用自制软件在Mac上安装任何第三方库或工具.看看: http://mxcl.github.com/homebrew/

First of all I suggest you to use homebrew to install any third part libraries or tools on your mac. Have a look to : http://mxcl.github.com/homebrew/

否则,对于您的问题,您可以搜索Mac上的mysql套接字在哪里,然后将其符号链接到/tmp.

Otherwise for your problem you can search where is the mysql socket on your mac and then symlink it to /tmp.

在您的终端中尝试类似:

In your terminal try something like :

locate mysql | grep sock

您会得到类似的东西:

/the/path/to/mysql.sock

然后做:

ln -s /the/path/to/mysql.sock /tmp/mysql.sock

这应该可行.

您还可以编辑php.ini文件以设置mysql套接字的正确路径.

Also you can edit your php.ini file to set the correct path for the mysql socket.

希望获得帮助.