解决Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’错误

刚刚在Linux里面安装好mysql,就显示Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’

解决方法:

1.用 find / -name mysql.sock查找mysql.sock,看是否存在

解决Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’错误

2.修改my.cnf文件

解决Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’错误


  添加如下部分

解决Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’错误

3.进入mysql 

 解决Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’错误

 没有设置密码的直接enter进入

解决Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’错误