mysql 启动 报socket ‘/tmp/mysql.sock‘错误

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

出现此错误原因是:在/etc/my.cnf配置文件中缺少[client] 配置项。

解决方法:

1、vi /etc/my.cnf配置文件 添加红色client配置

[mysqld]
bind-address= 0.0.0.0
port = 3306
user = mysql
basedir = /usr/local/mysql/mysql-5.7
datadir = /data/mysql
socket = /tmp/mysql.sock
symbolic-links = 0
 

[client]
port=3306
socket=/tmp/mysql.sock

2、启动mysql : service mysql start

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