来自macports的mysql错误:缺少mysqld.sock

时间:2011-08-06 02:00:45

标签: python mysql

我在终端中运行了以下内容:

sudo port install py26-mysql 
sudo port install mysql5-server

它似乎已经正确下载和安装,但是当我尝试使用/opt/local/lib/mysql5/bin/mysql打开mysql时出现以下错误:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/local/var/run/mysql5/mysqld.sock' (2)

有谁知道出了什么问题?

2 个答案:

答案 0 :(得分:2)

您是否激活了MySQL服务器?请参阅Step 3: Install MySQL下的说明。

答案 1 :(得分:0)

您必须将以下配置添加到/opt/local/etc/mysql57/my.cnf

[client]
socket=/opt/local/var/run/mysql57/mysqld.sock

[mysqld]
socket=/opt/local/var/run/mysql57/mysqld.sock