要解决此错误,有两种解决方法:
1、将连接参数“host”的值由“localhost”改成“127.0.0.1”;
- 2、按下面方法,在“/etc/mysql.cnf”中指定“sock文件”位置:
-
#vi /etc/my.cnf
-
[mysqld]
datadir=/storage/db/mysql
socket=/storage/db/mysql/mysql.sock
-
[client]
socket=/storage/db/mysql/mysql.sock
-
补充:
-
zabbix到安装界面报错" Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock"
-
解决办法:
-
#ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock #创建一个软连接