Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock问题解决

Posted vieber

tags:

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

报错提示

mysql -uroot -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)

在连接数据库的时候。连接不上,直接报了这个错误

解决办法

service mysqld start

执行这个命令,启动mysqld。这个时候就可以连接上了。

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

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

/var/lib/mysql 的访问权限问题 Can't connect to local MySQL server through socket '/var/lib/mysql/my

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

Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ 解决

MySQL报错的解决Can‘t connect to local MySQL server through socket ‘varlibmysqlmysql.soc

连接Mysql提示Can’t connect to local MySQL server through socket的解决方法