今天在修改mysql數據庫的配置文件,由於方便操作,就將“/etc/mysql/my.cnf” 的權限設置成 “777” 了,然后進行修改,當修改完進行重啟mysql的時候,卻報錯,提示Warning: World-writable config file '/etc/mysql/my.cnf' is ignored ,大概意思是權限全局可寫,任何一個用戶都可以寫。mysql擔心這種文件被其他用戶惡意修改,所以忽略掉這個配置文件。這樣mysql無法重啟。
下面看下整個過程
重啟MySQL
[root@ttlsa ~]# /etc/init.d/mysql restart 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的權限
1 [root@ttlsa ~]# ls -l /etc/my.cnf 2 -rwxrwxrwx 1 root root 4878 Jul 30 11:31 /etc/my.cnf
權限777,任何一個用戶都可以改my.cnf,存在很大的安全隱患.
修復MySQL問題
1 [root@ttlsa ~]# chmod 644 /etc/my.cnf
my.cnf設置為root用戶可讀寫,其他用戶不可寫.
重啟MySQL成功.