Linux

MariaDB 沒有啟動

  • December 13, 2016

我在 CentOS 7 上使用 Plesk 17 onyx。我已經通過 plesk 更新管理器更新了我的伺服器,但我的數據庫伺服器突然停止工作。我使用 MariaDB 作為數據庫伺服器。Plesk 也無法正常工作。

當我嘗試啟動,重新啟動 MariaDB 時,我發現以下錯誤作為輸出。

Redirecting to /bin/systemctl status  -l mariadb.service
● mariadb.service - MariaDB database server
  Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
  Active: failed (Result: exit-code) since Tue 2016-12-13 13:41:00 PKT; 10min ago
 Process: 8193 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=1/FAILURE)
 Process: 8192 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=0/SUCCESS)
 Process: 8164 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
Main PID: 8192 (code=exited, status=0/SUCCESS)

Dec 13 13:40:57 ns*.ip-19***** systemd[1]: Starting MariaDB database server...
Dec 13 13:40:57 ns*.ip-19***** mysqld_safe[8192]: 161213 13:40:57 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Dec 13 13:40:57 ns*.ip-19***** mysqld_safe[8192]: 161213 13:40:57 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Dec 13 13:41:00 ns*.ip-19***** mysqld_safe[8192]: 161213 13:41:00 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended
Dec 13 13:41:00 ns*.ip-19***** systemd[1]: mariadb.service: control process exited, code=exited status=1
Dec 13 13:41:00 ns*.ip-19***** systemd[1]: Failed to start MariaDB database server.
Dec 13 13:41:00 ns*.ip-19***** systemd[1]: Unit mariadb.service entered failed state.
Dec 13 13:41:00 ns*.ip-19***** systemd[1]: mariadb.service failed.

我也嘗試通過以下 plesk 命令修復 mysql

plesk help repair mysql

登錄/var/log/mariadb/mariadb.log

161213 14:01:15 Percona XtraDB (http://www.percona.com) 5.5.49-MariaDB-38.0 started; log sequence number 155782156
161213 14:01:15 [Note] Plugin 'FEEDBACK' is disabled.
161213 14:01:15 [ERROR] /usr/libexec/mysqld: unknown option '--safe-show-database'
161213 14:01:15 [ERROR] Aborting
161213 14:01:15  InnoDB: Starting shutdown...
161213 14:01:16  InnoDB: Shutdown completed; log sequence number 155782156
161213 14:01:16 [Note] /usr/libexec/mysqld: Shutdown complete
161213 14:01:16 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended

好像您正在為您的 MariaDB 重用舊版本的 MySQL 配置文件。有一個錯誤說unknown option '--safe-show-database',如果您檢查與該選項相關的文件,您會發現它已被棄用:

http://dev.mysql.com/doc/refman/5.5/en/server-options.html#option_mysqld_safe-show-database

此選項已棄用並且不執行任何操作,因為有一個 SHOW DATABASES 權限可用於控制對每個帳戶的數據庫名稱的訪問。請參閱第 6.2.1 節,“MySQL 提供的權限”。–safe-show-database 在 MySQL 5.5.3 中被刪除。

您必須進入 my.cnf 或 MariaDB 啟動腳本,找到該選項並將其刪除。

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