RHEL4U2 升級mysql的問題及解決

來源:互聯網
上載者:User
今天對rhel4 u2系統中的mysql進行了一下升級,本來很簡單的事情,卻遇到了一個意想不到的問題。
原系統中,mysql的版本是4.1.12升級為4.1.18。升級檔案是從官方網關下載的針對rhel4的現成rpm包。

mysql預設的資料檔案$datadir的路徑是/var/lib/mysql,由於/var下的空間已經比較小了,重新做了一個分區/mysql,然後將/var/lib/mysql中的資料移到/mysql下,為了避免修改設定檔用ln -s /mysql /var/lib/mysql做了連結。

結果問題就出在這裡了,mysql升級完成後,/etc/init.d/mysql start 執行失敗,經跟蹤發現,/usr/sbin/mysqld_safe 出現如下錯誤:

Starting MySQL
Starting mysqld daemon with databases from /var/lib/mysql
STOPPING server from pid file /var/lib/mysql/www.aaaaa.com.cn.pid
060416 21:14:25  mysqld ended

查看 /var/log/mysqld.log,只提示
060416 17:06:12  mysqld started
060416 17:06:12  mysqld ended

系統日誌message中,顯示
Apr 16 16:59:39 www kernel: audit(1145177979.106:127549): avc:  denied  { search } for  pid=27355 co
mm="mysqld" name="/" dev=sdb7 ino=2 scontext=root:system_r:mysqld_t tcontext=system_u:object_r:file_
t tclass=dir

但是,在root使用者下手動的運行
/usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/www.aaaaa.com.cn.pid &
卻是一切正常,mysql可以正常啟動起來,但是把這個命令放到 /etc/init.d/mysql指令碼裡,就是不能成功。

對這個問題百思不得其解,在google上多次搜尋,終於在http://www.linuxquestions.org中發現高人解答,原來是rhel4中的selinux惹的禍!!

解決方式: setsebool -P mysqld_disable_trans=1
看來該抽點時間學習學習selinux了。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.