1. 程式人生 > >MySQL無法重啟問題解決Warning: World-writable config file ‘/etc/my.cnf’ is ignored

MySQL無法重啟問題解決Warning: World-writable config file ‘/etc/my.cnf’ is ignored

許可權777,任何一個使用者都可以改my.cnf,存在很大的安全隱患.

修復MySQL問題

[[email protected] ~]# chmod 644 /etc/my.cnf

my.cnf設定為使用者可讀寫,其他使用者不可寫.

 

 

 

 

今天幫朋友維護伺服器,在關閉資料庫的命令發現mysql關不了,提示Warning: World-writable config file ‘/etc/my.cnf’ is ignored ,大概意思是許可權全域性可寫,任何一個使用者都可以寫。mysql擔心這種檔案被其他使用者惡意修改,所以忽略掉這個配置檔案。這樣mysql無法關閉。

下面看下整個過程

重啟MySQL

[[email protected] ~]# 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的許可權

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

許可權777,任何一個使用者都可以改my.cnf,存在很大的安全隱患.

修復MySQL問題

[[email protected] ~]# chmod 644 /etc/my.cnf

my.cnf設定為使用者可讀寫,其他使用者不可寫.

關閉MySQL

[[email protected] ~]# service mysqld stop
Shutting down MySQL..[  OK  ]

MySQL關閉成功. 問題很簡單

 

轉自http://www.ttlsa.com/mysql/warning-world-writable-config-file-etcmy-cnf-is-ignored/