连接数据库报错:ERROR 2002 (HY000): 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)

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

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

 

 

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

 

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

 

posted @ 2020-02-10 16:23  802.11  阅读(1224)  评论(0编辑  收藏  举报