当前位置: 代码迷 >> 综合 >> mysql启动失败错误mysqld.service holdoff time over, scheduling restart.
  详细解决方案

mysql启动失败错误mysqld.service holdoff time over, scheduling restart.

热度:35   发布时间:2023-09-29 01:35:16.0

由于搭建主从分布式mysql环境,在搭建前,对之前的mysql残留环境彻底清除。清除命令如下:

#yum remove mysql* mariadb* -y           

#rm /etc/my.cnf                          

#rm -rf /var/lib/mysql                   

#rm -rf /usr/share/mysql                 

#rm -rf /usr/lib/mysql                   

查询mysql服务                            

#systemctl list-unit-files | grep mysql  

#systemctl disable mysqld.service        

#systemctl disable mysql.service         

#rm -rf /var/run/mysql/                  

#rm -rf /etc/mecabrc                         

#rm -rf /usr/lib/systemd/system/mysqld.service

#rm -rf /etc/systemd/system/mysqld.service   

#rm -rf /etc/systemd/system/mysql.service    

 

清除后,对Mysql配置文件进行配置后,加入了日志参数,大致如下:

datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
read_only=on
log_bin=mysql-bin
log-slave-updates
server-id=162
binlog_format=row

重启mysql,发现一直启动失败。查看日志,并没有具体的ERROR日志,只是启动不了。因为以前部署主从,都是按照这种方式来部署的,所以不存在是配置文件的问题。但我将所有主从配置去掉后,重启mysql后又能正常启动。于是我一条条定位添加的配置,发现错误出现在:log_bin=mysql-bin这个参数上,只要去掉它就能启动成功。想配置主从,这个参数是必须要添加的,所以只能再次查看日志/var/log/mysqld.log和/var/log/messages,发现报错:

Oct 26 10:01:19 lf-319-162 systemd: Failed to start MySQL Server.
Oct 26 10:01:19 lf-319-162 systemd: Unit mysqld.service entered failed state.
Oct 26 10:01:19 lf-319-162 systemd: mysqld.service failed.
Oct 26 10:01:20 lf-319-162 systemd: mysqld.service holdoff time over, scheduling restart.
Oct 26 10:01:20 lf-319-162 systemd: Starting MySQL Server...
Oct 26 10:01:20 lf-319-162 mysqld: Initialization of mysqld failed: 0
Oct 26 10:01:20 lf-319-162 systemd: mysqld.service: control process exited, code=exited status=1
Oct 26 10:01:22 lf-319-162 systemd: Failed to start MySQL Server.

百度后发现,只需要重启服务器就能完成,原因是:无法重新加载配置文件

最后reboot重启服务器,发现问题解决啦!!

 

  相关解决方案