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

Posted Mr Wen

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了连接数据库报错: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.sock\' (2)

1、楼主是新安装的mysql,注意新安装完成不会默认启动服务

2、百度上各种处理办法均不对,查看数据库状态发现未启动!!!

 

 

3、重启把服务拉起即可成功连接:systemctl start mariadb.service 

 

4、安装新服务后一定要先检查服务的状态信息,再去判断报错!!!

 

以上是关于连接数据库报错:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mys的主要内容,如果未能解决你的问题,请参考以下文章

解决MySQL报错ERROR 2002 (HY000)

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

长久不用的mysql报错ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mys

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

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

TP连接数据库报错:SQLSTATE[HY000] [2002] No such file or directory