Failed to start LSB: start and stop MariaDB

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

原文地址:https://www.cnblogs.com/halberd-lee/p/11070582.html