MySQL无法重启报错Warning: World-writable config file ‘/etc/my.cnf’ is ignored的解决方法

来源:互联网 发布:b站镇站之宝 知乎 编辑:程序博客网 时间:2024/05/17 01:39
最近在维护公司服务器的时候,在关闭数据库的命令发现mysql关不了了,提示错误为Warning: World-writable config file '/etc/my.cnf' is ignored,通过查找网上的资料终于解决了,现在将解决的方法分享给大家,同样遇到这个问题的朋友们可以参考借鉴。

问题分析

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

下面看下整个过程

重启MySQL

[root@ttlsa ~]# service mysqld stopWarning: World-writable config file '/etc/my.cnf' is ignoredWarning: World-writable config file '/etc/my.cnf' is ignoredMySQL manager or server PID file could not be found![FAILED]

可以看到mysql停止不了

查看my.cnf的权限

[root@ttlsa ~]# ls -l /etc/my.cnf-rwxrwxrwx 1 root root 4878 Jul 30 11:31 /etc/my.cnf

权限777,任何一个用户都可以改my.cnf,存在很大的安全隐患.

修复MySQL问题

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

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

关闭MySQL

[root@ttlsa ~]# service mysqld stopShutting down MySQL..[ OK ]

MySQL关闭成功. 问题很简单

阅读全文
0 0
原创粉丝点击