mysql客户连接时报ERROR 2002 (HY000)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql客户连接时报ERROR 2002 (HY000)相关的知识,希望对你有一定的参考价值。

ERROR 2002 (HY000): Can‘t connect to local mysql server through socket ‘/var/lib/mysql/mysql.sock‘ (2)

修改my.cnf 配置文件

原因

修改mysqld下socket属性位置导致

解决方案

增加client配置,其中socket路径与mysqld一致
[client]
socket=/var/lib/mysql_xx/mysql.sock
重启服务后即可解决

以上是关于mysql客户连接时报ERROR 2002 (HY000)的主要内容,如果未能解决你的问题,请参考以下文章

启动 mysql 时报错

mysql连接:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mys

Mac mySql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/my

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock'

连接数据库报错:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mys

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql