Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2

Posted

tags:

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

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

正如上述所说的问题,缺少mysql.sock文件。

解决办法:

ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock

k

可能部分同学会报错在/var/lib目录下没有mysql目录,若出现如此错误就创建mysql目录,在执行上述命令就会成功

本文出自 “开源是精神,分享是美德” 博客,请务必保留此出处http://hongtengfei.blog.51cto.com/9881650/1747434

以上是关于Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2的主要内容,如果未能解决你的问题,请参考以下文章

MySQL Can't connect to MySQL server on 'localhost' (10061)

Jenkins: Can't connect to Docker daemon解决办法

MySQL错误2003:Can't connect to MySQL server (10060)

Can't connect to MySQL server on 'localhost'(10061)解决方法

MySQL:Can't connect to mysql server 10038

解决Can't connect to MySQL server on 'localhost' (10048)