Failed to start LSB: start and stop MariaDB


Failed to start LSB: start and stop MariaDB

1 總結

Failed to start LSB: start and stop MariaDB 這僅是一個提示,提示我們數據庫無法 正常啟動。至於具體原因,在這個錯誤之前的信息里有的可能提示,有的並沒有提示。這就需要我 們抽絲剝繭,一點一點去研究,分析。

在我遇到的這個問題里,有以下幾點原因(文章隨時可能更新):

  • 參數配置不正確
    參數配置不正確時,有時也會出現這個錯誤。Mariadb 中的一些參數,與原來的MySQL參數所屬選項不一樣。比如log-error原來屬於[mysql_safe] 而新版本的Mariadb 中應屬於[mysqld].
  • 路徑不存在
    比如log-error相關路徑沒有創建。檢查參數文件是否配置,如果有配置,配置路徑是否都存在。
  • 數據庫跳過回滾大事備,導致的數據不一致。
    執行大事務中斷后,關鍵表被鎖,回滾的耗時長到人神共憤,於是將數據庫關閉,配置 innodb_force_recover參數,規避回滾事務而啟動數據庫,之后沒有通過邏輯備份 重建數據庫。

日后遇到其他原因,再補充。

2 錯誤信息

Jun 22 21:40:11 test1 systemd[1]: Starting LSB: start and stop MariaDB...
Jun 22 21:40:11 test1 mysqld[29013]: Starting MariaDB.190622 21:40:11 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Jun 22 21:40:11 test1 mysqld[29013]: 190622 21:40:11 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Jun 22 21:40:12 test1 mysqld[29013]: /etc/rc.d/init.d/mysqld: line 264: kill: (29029) - No such process
Jun 22 21:40:12 test1 mysqld[29013]: ERROR!
Jun 22 21:40:12 test1 systemd[1]: mysqld.service: control process exited, code=exited status=1
Jun 22 21:40:12 test1 systemd[1]: Failed to start LSB: start and stop MariaDB.
Jun 22 21:40:12 test1 systemd[1]: Unit mysqld.service entered failed state.
Jun 22 21:40:12 test1 systemd[1]: mysqld.service failed.

從錯誤信息上來看,什么有用的信息都沒有。

報錯退出之前mysql 要做的操作是" Logging to '/var/log/mariadb/mariadb.log". 看看日志吧。 結果發現沒有這個日志

3 解決

3.1 路徑問題

  • 查看相關參數

    [root@test1 mysql]# grep log-err /etc/my.cnf
    log-error=/var/log/mariadb/mariadb.log
    [root@test1 mysql]# ls /var/log|grep mariadb
    [root@test1 mysql]#
    

    通過以上兩步操作,確認,相關路徑確實是不存在的。

    創建相關路徑:

    mkdir -p /var/log/mariadb
    
  • 啟動數據庫

    systemctl start mysqld
    

    就這樣成功了。

Author: halberd.lee

Created: 2019-08-10 Sat 23:16

Validate


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM