8

解决mysql服务(mysqld)启动失败 提示/etc/my.conf 被忽略的问题 Warning: World-writa...

 2 years ago
source link: https://hellodk.cn/post/384
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

解决mysql服务(mysqld)启动失败 提示/etc/my.conf 被忽略的问题 Warning: World-writable config file '/etc/my.cnf' is ignored

本文也算是一种解决 typecho 报 error establishing a database connection 的方法

以下正文

给 vps 新建 snapshot 做备份后重新启动机器,访问此站,看到如下页面
20200819220147.png

typecho 提示 error establishing a database connection

这很明显是 数据库连接没有建立起来,很可能是 mysqld 服务没有启。

重启了 mysqld 服务依然还是不行

systemctl restart mysqld

查看 mysqld 服务的状态

systemctl status mysqld

看到如下重要日志 Warning: World-writable config file '/etc/my.cnf' is ignored

Aug 19 21:44:32 sfo2 mysqld[1655]: Warning: World-writable config file '/etc/my.cnf' is ignored
Aug 19 21:44:32 sfo2 mysqld[1655]: Starting MySQL.Warning: World-writable config file '/etc/my.cnf' is ignored
Aug 19 21:44:32 sfo2 mysqld[1655]: Warning: World-writable config file '/etc/my.cnf' is ignored
Aug 19 21:44:34 sfo2 mysqld[1655]: . ERROR! The server quit without updating PID file (/www/server/mysql/data/sfo2.pid).

世界上任何人都可以写这个文件,说明该文件被赋予的权限太高?

ll 一下 果真是 777

[root@sfo2 ~]# ll /etc/my.cnf
-rwxrwxrwx 1 root root 1426 Dec 16 2019 /etc/my.cnf

改成 644 后 再重启机器 即可

[root@sfo2 ~]# chmod 644 /etc/my.cnf
[root@sfo2 ~]# reboot

重启后 查看 mysqld 状态的确是 active (running)

本文解决方法来自 mysql启动时,提示/etc/my.cnf 被忽略的问题处理 https://blog.csdn.net/yumushui/article/details/49124699

写本文主要是为了本人记录,end


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK