Mysql修改datadir導致無法啟動問題解決方法_MySQL教程

      編輯Tag賺U幣
      教程Tag:暫無Tag,歡迎添加,賺取U幣!

      推薦:mysql 查詢重復的數據的SQL優化方案
      在mysql中查詢不區分大小寫重復的數據,往往會用到子查詢,并在子查詢中使用upper函數來將條件轉化為大寫。如: 代碼如下: select * from staticcatalogue WHERE UPPER(Source) IN (SELECT UPPER(Source) FROM staticcatalogue GROUP BY UPPER(Source) having count(UP

       centos6.2,停止mysqld然后修改/etc/my.cnf datadir的位置,啟動mysqld提示FAILED,查看日志

      代碼如下:
      120609 11:31:31 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
      120609 11:35:12 mysqld_safe Starting mysqld daemon with databases from /mnt/hgfs/mysql_data
      120609 11:35:13 [Warning] Can't create test file /mnt/hgfs/mysql_data/data.lower-test
      120609 11:35:13 [Warning] Can't create test file /mnt/hgfs/mysql_data/data.lower-test
      /usr/libexec/mysqld: Can't change dir to '/mnt/hgfs/mysql_data/' (Errcode: 13)
      120609 11:35:13 [ERROR] Aborting

       

      120609 11:35:13 [Note] /usr/libexec/mysqld: Shutdown complete

      120609 11:35:13 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended


      新的datadir路徑確實沒問題,而且目錄和目錄下所有文件都是777權限,上層目錄也有rx權限,只不過datadir和下屬文件owner都是root(因為我用虛擬機掛載的windows的文件系統)。后來想到應該是selinux搞的鬼,設置為permissive模式之后正常啟動mysqld。

      代碼如下:
      [root@data selinux]# getenforce
      Enforcing
      [root@data selinux]# setenforce 0
      [root@data selinux]# getenforce
      Permissive

       

      setenforce 1 設置SELinux 成為enforcing模式
      setenforce 0 設置SELinux 成為permissive模式

      徹底關閉,vi /etc/selinux/config 修改 SELINUX=disabled

       

      代碼如下:
      # This file controls the state of SELinux on the system.
      # SELINUX= can take one of these three values:
      #     enforcing - SELinux security policy is enforced.
      #     permissive - SELinux prints warnings instead of enforcing.
      #     disabled - No SELinux policy is loaded.
      SELINUX=disabled
      # SELINUXTYPE= can take one of these two values:
      #     targeted - Targeted processes are protected,
      #     mls - Multi Level Security protection.
      SELINUXTYPE=targeted

      分享:mysql的左右內連接用法實例
      本文實例講述了mysql的左右內連接用法。分享給大家供大家參考。具體如下: 用個例子來解析下mysql的左連接, 右連接和內連接 代碼如下:create table user_id ( id decimal(18) ); create table user_profile ( id decimal(18) , name varchar(255) ) ; insert into use

      來源:模板無憂//所屬分類:MySQL教程/更新時間:2015-03-07
      相關MySQL教程