linux下进mysql报ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock

Posted 闭关苦炼内功

tags:

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

部署好mysql5.7,跟往常一样,mysql -uroot -p 进mysql数据库 ,结果报错
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’
这个错误很简单,下面教你如何高效快速解决


编辑 /etc/my.cnf 文件

在最后添加

[client]
port=3306
socket=/var/lib/mysql/mysql.sock

然后重启mysql服务,再进mysql数据库

成功解决问题


搞技术一定要严谨!

以上是关于linux下进mysql报ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock的主要内容,如果未能解决你的问题,请参考以下文章

MySQL登录报错ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.

解决Linux MySQL报错ERROR 2002

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

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

解决MySQL报错ERROR 2002 (HY000)

解决MySQL报错ERROR 2002 (HY000)