问题

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket
‘/var/lib/mysql/mysql.sock’ (111)

问题

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket
‘/Data/mydata/mysql.sock’ (2)

[root@centos7-9-2009-zsc html]# mysql -u root -p -S /Data/mydata/mysql.sock

wenti

mysql: [ERROR] Found option without preceding group in config file /etc/my.cnf at line 22!
mysql: [ERROR] Fatal error in defaults handling. Program aborted!
在这里插入图片描述

wenti

mysql: [ERROR] unknown variable ‘symbolic-links=0’

几经挫折

上午同学2002的错误,看了看他们找的一篇文章。
我用了一下,结果 mysqld服务启动成功了。

在这里插入图片描述

错误总找上门,我每天都在纠正错误或者错误在找我的路上

珍惜

当然,我在输入[root@centos7-9-2009-zsc mysqld]# mysql -uroot -pZsc@123456 的时候,报的错误:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111).
我就查啊查,都跟我的不太一样,没搞对,在此期间,我也发现了mysql的服务未启动,但我没直接去查询该问题。
后来,,,
查询了服务未能启动。。

[root@centos7-9-2009-zsc mysqld]# systemctl start mysqld Job for
mysqld.service failed because the control process exited with error
code. See "systemctl status mysqld.service" and "journalctl -xe" for
details.

又查看了日志问题:

grep ERROR 2022-11-19T07:01:13.005053Z 0 [ERROR] Can't start server:
can't check PID filepath: No such file or directory
2022-11-23T08:05:19.294185Z 0 [ERROR] Can't start server: can't check
PID filepath: No such file or directory 2022-11-23T08:18:40.882570Z 0
[ERROR] /usr/sbin/mysqld: Can't create/write to file
'/var/run/mysqld/mysqld.pid' (Errcode: 13 - Permission denied)
2022-11-23T08:18:40.882583Z 0 [ERROR] Can't start server: can't create
PID file: Permission denied 2022-11-23T08:24:16.343148Z 0 [ERROR]
/usr/sbin/mysqld: Can't create/write to file
'/var/run/mysqld/mysqld.pid' (Errcode: 13 - Permission denied)
2022-11-23T08:24:16.343160Z 0 [ERROR] Can't start server: can't create
PID file: Permission denied 2022-11-23T08:30:15.049012Z 0 [ERROR]
/usr/sbin/mysqld: Can't create/write to file
'/var/run/mysqld/mysqld.pid' (Errcode: 13 - Permission denied)
2022-11-23T08:30:15.049035Z 0 [ERROR] Can't start server: can't create
PID file: Permission denied 2022-11-23T08:50:10.265849Z 0 [ERROR]
/usr/sbin/mysqld: Can't create/write to file
'/var/run/mysqld/mysqld.pid' (Errcode: 13 - Permission denied)
2022-11-23T08:50:10.265870Z 0 [ERROR] Can't start server: can't create
PID file: Permission denied   ```

然后,使用大佬的这个方法就成功启动啦

在这里插入图片描述

建立缺少的目录
mkdir -p /var/run/mysqld
systemctl start mysqld

此是还是无法启动,修改目录权限

chown mysql.mysql /var/run/mysqld/ systemctl start mysqld

我是错误的搬运工

有需要的请自取

在这里插入图片描述

cankao

http://t.csdn.cn/SrzJe
http://t.csdn.cn/L8uIS
http://t.csdn.cn/gCeWB

Logo

更多推荐