Linux

MySQL伺服器退出而不更新PID文件

  • March 30, 2016

我需要有關如何啟動 mysql 伺服器的幫助。當根目錄已滿時會出現問題。為了能夠登錄到directadmin並啟動mysql,我將/var/lib/mysql/的軟連結添加到/home/mysql。由於我的數據庫用完了數據庫。/ 目錄有 50Gb,/home 有 1.5Gb。但是我仍然無法啟動mysql。

我跑/etc/init.d/mysqld status了,結果如下:

MySQL is not running, but lock file (/var/lock/subsys/mysql)

我嘗試刪除文件 /var/lock/subsys/mysql

但是當我嘗試啟動 mysql 時,它給了我下面的結果:

[root@fst /]# /etc/init.d/mysqld start
Starting MySQL.The server quit without updating PID file (/var/lib/mysql/fst.srv.net.pid).

我已經檢查了 mysql 的權限和文件所有者,但結果相同。

chmod 755 -R /var/lib/mysql
chown mysql:root /var/lib/mysql

我也找不到 mysql.sock。但我猜它會在啟動時由mysql創建。

以下是錯誤日誌的內容

121212 01:04:22 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
121212  1:04:22 [Note] Plugin 'FEDERATED' is disabled.
121212  1:04:22 InnoDB: The InnoDB memory heap is disabled
121212  1:04:22 InnoDB: Mutexes and rw_locks use GCC atomic builtins
121212  1:04:22 InnoDB: Compressed tables use zlib 1.2.3
121212  1:04:22 InnoDB: Using Linux native AIO
121212  1:04:22 InnoDB: Initializing buffer pool, size = 128.0M
121212  1:04:22 InnoDB: Completed initialization of buffer pool
InnoDB: Error: auto-extending data file ./ibdata1 is of a different size
InnoDB: 64 pages (rounded down to MB) than specified in the .cnf file:
InnoDB: initial 640 pages, max 0 (relevant if non-zero) pages!
121212  1:04:22 InnoDB: Could not open or create data files.
121212  1:04:22 InnoDB: If you tried to add new data files, and it failed here,
121212  1:04:22 InnoDB: you should now edit innodb_data_file_path in my.cnf back
121212  1:04:22 InnoDB: to what it was, and remove the new ibdata files InnoDB created
121212  1:04:22 InnoDB: in this failed attempt. InnoDB only wrote those files full of
121212  1:04:22 InnoDB: zeros, but did not yet use them in any way. But be careful: do not
121212  1:04:22 InnoDB: remove old data files which contain your precious data!
121212  1:04:22 [ERROR] Plugin 'InnoDB' init function returned error.
121212  1:04:22 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
121212  1:04:22 [ERROR] Unknown/unsupported storage engine: InnoDB
121212  1:04:22 [ERROR] Aborting

121212  1:04:22 [Note] /usr/sbin/mysqld: Shutdown complete

它讓我感到困惑是什麼問題。請向我提供您的幫助。我已經研究這個問題兩天了。

看起來您的 InnoDB 索引已損壞。

InnoDB: Error: auto-extending data file ./ibdata1 is of a different size
121212  1:04:22 InnoDB: Could not open or create data files.

嘗試將/var/lib/mysql/ibdata1,/var/lib/mysql/ibdata2等移動到另一個目錄並再次啟動伺服器。它應該重建索引文件。一旦完成並且您驗證一切都再次正常工作,您可以刪除舊的損壞的。

引用自:https://serverfault.com/questions/457337