mysql啟動報錯:Starting MySQL... ERROR! The server quit without updating PID file

來源:互聯網
上載者:User

標籤:注釋   ges   附加   blog   contain   解決   time   這一   ace   

mysql啟動時報錯:Starting MySQL... ERROR! The server quit without updating PID file (/opt/mysql/data/mysql.pid) 的解決方案:

 http://blog.51cto.com/732233048/1636409

 

 

1、可能是/opt/mysql/data/資料目錄mysql使用者沒有許可權(修改資料目錄的許可權)

   解決方案 :給予許可權,執行  "chown -R mysql.mysql /opt/mysql/data"  然後重新啟動mysqld

 

2、可能進程裡已經存在mysql進程

   解決方案:用命令“ps -ef|grep mysqld”查看是否有mysqld進程,如果有使用“kill -9  進程號”殺死,然後重新啟動mysqld!

 

3、可能是第二次在機器上安裝mysql,有殘餘資料影響了服務的啟動。

   解決方案:去mysql的二進位日誌目錄看看,如果存在mysql-binlog.index,就趕快把它刪除掉吧

 

4、mysql在啟動時沒有指定設定檔時會使用/etc/my.cnf設定檔,請開啟這個檔案查看在[mysqld]下有沒有指定資料目錄(datadir)。

   解決方案:請在[mysqld]下設定這一行:datadir = /opt/mysql/data

 

5、skip-federated欄位問題

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

 

6、錯誤記錄檔目錄不存在

   解決方案:使用“chown” “chmod”命令賦予mysql所有者及許可權

 

7、selinux惹的禍,如果是centos系統,預設會開啟selinux

   解決方案:先臨時改為警告模式:[[email protected] php]# setenforce 0

             然後開啟/etc/sysconfig/selinux,把SELINUX=enforcing改為SELINUX=disabled

 

 

 

 

 

附加:

經驗之談:

還有一個原因可能是:

查看設定檔/usr/local/mysql/my.cnf裡有沒有innodb_buffer_pool_size這個參數

innodb_buffer_pool_size:主要作用是緩衝innodb表的索引,資料,插入資料時的緩衝;

                                            預設值:128M;

                                            專用mysql伺服器設定此值的大小: 系統記憶體的70%-80%最佳。

                                            如果你的系統記憶體不大,查看這個參數,把它的值設定小一點吧

 

 

 

總結:

    在設定檔/etc/my.cnf添加錯誤記錄檔參數,一切問題都解決  

12 [mysqld_safe]log-error = /data/mysql/logs/error.log

        啟動報錯時查看日誌資訊:

12345678910111213141516171819202122232425262728 #tail -f /data/mysql/logs/error.log 160721 06:12:07 mysqld_safe Starting mysqld daemon with databases from /data/mysql/data2016-07-21 06:12:10 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).2016-07-21 06:12:10 0 [Note] /opt/mysql/bin/mysqld (mysqld 5.6.27-log) starting as process 2290 ...2016-07-21 06:12:10 2290 [Note] Plugin ‘FEDERATED‘ is disabled.2016-07-21 06:12:10 2290 [Warning] The option innodb (skip-innodb) is deprecated and will be removed in a future release2016-07-21 06:12:10 2290 [Note] InnoDB: Using atomics to ref count buffer pool pages2016-07-21 06:12:10 2290 [Note] InnoDB: The InnoDB memory heap is disabled2016-07-21 06:12:10 2290 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins2016-07-21 06:12:10 2290 [Note] InnoDB: Memory barrier is not used2016-07-21 06:12:10 2290 [Note] InnoDB: Compressed tables use zlib 1.2.32016-07-21 06:12:10 2290 [Note] InnoDB: Using CPU crc32 instructions2016-07-21 06:12:10 2290 [Note] InnoDB: Initializing buffer pool, size = 128.0M2016-07-21 06:12:10 2290 [Note] InnoDB: Completed initialization of buffer pool2016-07-21 06:12:10 2290 [Note] InnoDB: Highest supported file format is Barracuda.2016-07-21 06:12:11 2290 [Note] InnoDB: 128 rollback segment(s) are active.2016-07-21 06:12:11 2290 [Note] InnoDB: Waiting for purge to start2016-07-21 06:12:11 2290 [Note] InnoDB: 5.6.27 started; log sequence number 16259972016-07-21 06:12:11 2290 [ERROR] /opt/mysql/bin/mysqld: unknown option ‘--slave_parallel_workers=3‘2016-07-21 06:12:11 2290 [ERROR] Aborting2016-07-21 06:12:11 2290 [Note] Binlog end2016-07-21 06:12:11 2290 [Note] Shutting down plugin ‘partition‘2016-07-21 06:12:11 2290 [Note] Shutting down plugin ‘INNODB_SYS_DATAFILES‘2016-07-21 06:12:11 2290 [Note] Shutting down plugin ‘INNODB_SYS_TABLESPACES‘2016-07-21 06:12:11 2290 [Note] Shutting down plugin ‘INNODB_SYS_FOREIGN_COLS‘2016-07-21 06:12:11 2290 [Note] Shutting down plugin ‘INNODB_SYS_FOREIGN‘2016-07-21 06:12:11 2290 [Note] Shutting down plugin ‘INNODB_SYS_FIELDS‘

     發現日誌輸出

12 2016-07-21 06:12:11 2290 [ERROR] /opt/mysql/bin/mysqld: unknown option ‘--slave_parallel_workers=3‘2016-07-21 06:12:11 2290 [ERROR] Aborting

    肯定是設定檔裡加入了這個錯誤參數,去掉即可

 

 

 

新加報錯:

Starting MySQL.171019 10:11:54 mysqld_safe error: log-error set to ‘/data/tools/mysql/logs/error.log‘, however file don‘t exists. Create writable for user ‘mysql‘.

這是在mysql新版本:5.6.35,5.6.36的一個bug

參考:https://bugs.mysql.com/bug.php?id=84427
解決:

 

手動建立記錄檔:

touch /data/tools/mysql/logs/error.log

chown mysql. /data/tools/mysql/logs/error.log

/etc/init.d/mysqld start

 

mysql啟動報錯:Starting MySQL... ERROR! The server quit without updating PID file

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.