首页>>帮助中心>>香港VPSWarning: World-writable config file ‘/etc/my.cnf’ is ignored

香港VPSWarning: World-writable config file ‘/etc/my.cnf’ is ignored

2025/2/18 105次

香港VPS在关闭数据库的命令发现mysql关不了,提示Warning: World-writable config file ‘/etc/my.cnf’ is ignored ,大概意思是权限全局可写,任何一个用户都可以写。mysql担心这种文件被其他用户恶意修改,所以忽略掉这个配置文件。这样mysql无法关闭。
下面看下整个过程
重启MySQL

[root@landui]# service mysqld stop
Warning: World-writable config file ‘/etc/my.cnf’ is ignored
Warning: World-writable config file ‘/etc/my.cnf’ is ignored
MySQL manager or server PID file could not be found![FAILED]

可以看到mysql停止不了
查看my.cnf的权限


[root@landui]# ls -l /etc/my.cnf
-rwxrwxrwx 1 root root 4878 Jul 30 11:31 /etc/my.cnf
权限777,任何一个用户都可以改my.cnf,存在很大的安全隐患.
修复MySQL问题

[root@landui]# chmod 644 /etc/my.cnf


my.cnf设置为用户可读写,其他用户不可写.
关闭MySQL

[root@landui]# service mysqld stop
Shutting down MySQL..[ OK ]

购买使用一诺网络香港服务器,可以极大降低初创企业、中小企业以及个人开发者等用户群体的整体IT使用成本,无需亲自搭建基础设施、简化了运维和管理的日常工作量,使用户能够更专注于自身的业务发展和创新。香港服务器低至29元/月,购买链接:https://www.enuoidc.com/vps.html?typeid=2