2024-02-01 ERROR 2002 (HY000) Can‘t connect to local MySQL server thr
1. 错误产生2. 错误产生缘故原由解析
3. 修复问题前预备
3.1 端口是否打开
3.2 mysqld服务是否正在运行
3.3 确定“socket”文件精确位置
4. 问题解决方法
连接Mysql ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’()
1. 错误产生
# mysql -p
Enter password:
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
https://img-blog.csdnimg.cn/img_convert/7685a3c1bf6f3c3a078236e444ca547c.webp?x-oss-process=image/format,png
2. 错误产生缘故原由解析
根据配置文件“/etc/my.cnf”的路径,未找到相应的socket文件,就会引发此错误
3. 修复问题前预备
由于“socket”文件是由mysql服务运行时创建的,如果提示“ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘***’ (2)”,找不到“socket”文件,我们首先要确认的是mysql服务是否正在运行。
3.1 端口是否打开
# netstat -antlp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp6 0 0 :::3306 ::
页:
[1]