ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)解决方法

Linux下登录mysql是出现这样的问题ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)
首先查看一下mysql运行情况
systemctl status mysqld
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)解决方法_第1张图片
这就表明mysql没有处于运行状态 当然登录不了mysql了。这个很好解决停止mysql
systemctl stop mysqld
然后再用systemctl status mysqld查看一下mysql的运行 情况可以看到mysql处于死亡状态。
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)解决方法_第2张图片
最后重启一下mysql
systemctl start mysqld
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)解决方法_第3张图片
问题就完美解决了。

你可能感兴趣的:(linux,数据库)