2015-12-02 60 views
1

我試圖改變mysql的data_dir。 所以,我沒有在RHEL 6.6上更改mysql的目錄dir 6.6

  1. 須藤/etc/init.d/mysql停止

  2. 改變/etc/mysql/my.cnf數據錄入到新的位置

  3. 須藤/ etc/init.d/mysql start

失敗。日誌說

151201 15:43:31 [Note] /usr/libexec/mysqld: Shutdown complete 

151201 15:43:31 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended 
151201 16:06:15 mysqld_safe Starting mysqld daemon with databases from /data/data_raid5_0/mysql 
151201 16:06:15 [Warning] Can't create test file /data/data_raid5_0/mysql/PEC630.lower-test 
151201 16:06:15 [Warning] Can't create test file /data/data_raid5_0/mysql/PEC630.lower-test 
/usr/libexec/mysqld: Can't change dir to '/data/data_raid5_0/mysql/' (Errcode: 13) 
151201 16:06:15 [ERROR] Aborting 

151201 16:06:15 [Note] /usr/libexec/mysqld: Shutdown complete 

151201 16:06:15 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended 

我開始還以爲是寫權限問題,但修復它之後,我仍然得到同樣的錯誤日誌。

任何人都可以給我一些建議。謝謝!

回答

0

錯誤的原因可能是您沒有將正確的SELinux上下文恢復到MySQL新的datadir。試試這個命令:

chcon -R --reference=/var/lib/mysql/ /data/data_raid5_0/mysql/ 

P.S:MySQL的配置文件是/etc/my.cnf,不/etc/mysql/my.cnf,但我相信這只是一個錯字。