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

Posted AI浩

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘相关的知识,希望对你有一定的参考价值。

解决方法:

由于mysql 默认的mysql.sock 是在/var/lib/mysql/mysql.sock,但linux系统总是去/tmp/mysql.sock查找,所以会报错

[root@localhost ~]# find / -name mysql.sock
/var/lib/mysql/mysql.sock

直接指定mysql通道

[root@localhost ~]# mysql --socket=/var/lib/mysql/mysql.sock

以上是关于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 mysql 启动不了

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var mysql 启动不了

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var mysql 启动不了(转载)

mysql连接报错 ERROR 2002 (HY000): Can't connect to local MySQL server through socket

Problemxampp in ubuntu下命令行启动mysql报错: ERROR 2002 (HY000): Can't connect to local MySQL server t(代

(转)ERROR 2002 (HY000): Can't connect to local MySQL server through socket '***' (示例代码(代码