Centos操作mysql問題集錦,centosmysql

來源:互聯網
上載者:User

Centos操作mysql問題集錦,centosmysql

問題:

1,出現了問題[root@rekfan mysql]# service mysql restart
MySQL server PID file could not be found![失敗]
Starting MySQL...The server quit without updating PID file (/usr/local/mysql/data/rekfan.pid).[失敗]

我的解決方式:

/usr/local/mysql/data/rekfan.pid檔案沒有寫的許可權
解決方案 :給予許可權,執行 “chown -R mysql:mysql /var/data” “chmod -R 755 /usr/local/mysql/data”  然後重新啟動mysqld!


網上給出的一些可能的解決方式為:

1.可能是/usr/local/mysql/data/rekfan.pid檔案沒有寫的許可權
解決方案 :給予許可權,執行 “chown -R mysql:mysql /var/data” “chmod -R 755 /usr/local/mysql/data”  然後重新啟動mysqld!

2.可能進程裡已經存在mysql進程
解決方案:用命令“ps -ef|grep mysqld”查看是否有mysqld進程,如果有使用“kill -9  進程號”殺死,然後重新啟動mysqld!

3.可能是第二次在機器上安裝mysql,有殘餘資料影響了服務的啟動。
解決方案:去mysql的資料目錄/data看看,如果存在mysql-bin.index,就趕快把它刪除掉吧,它就是罪魁禍首了。本人就是使用第三條方法解決的 !http://blog.rekfan.com/?p=186

4.mysql在啟動時沒有指定設定檔時會使用/etc/my.cnf設定檔,請開啟這個檔案查看在[mysqld]節下有沒有指定資料目錄(datadir)。
解決方案:請在[mysqld]下設定這一行:datadir = /usr/local/mysql/data

5.skip-federated欄位問題
解決方案:檢查一下/etc/my.cnf檔案中有沒有沒被注釋掉的skip-federated欄位,如果有就立即注釋掉吧。

6.錯誤記錄檔目錄不存在
解決方案:使用“chown” “chmod”命令賦予mysql所有者及許可權

7.selinux惹的禍,如果是centos系統,預設會開啟selinux
解決方案:關閉它,開啟/etc/selinux/config,把SELINUX=enforcing改為SELINUX=disabled後存檔退出重啟機器試試。


相關文章

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.