ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
[root@localhost mysql]# ps -ef | grep mysql
root 32092 2108 0 22:43 pts/0 00:00:00 grep mysql
查看/tmp文件夹的确没有mysql.sock文件,
通过find命令查找
[root@localhost /]# find / -name mysql.sock
/tmp/mysql.sock
原来安装到/tmp/mysql.sock这个位置啦,我们需要修改my.cnf文件
[root@localhost /]# vi /usr/local/mysql/my.cnf
[client]
character-set-server = utf8
port = 3306
socket = /tmp/mysql.sock
……
保存之后即出,重新启动mysql。