mysql缺少binlog启动失败
mysql启动的时候会根据binlog.index(有些环境的名字是mysql-bin.index)的内容来选定binlog。清空binlog.index(有些环境的名字是mysql-bin.index)里的内容,重启mysqld服务就行了。磁盘空间满了,mysql目录下的文件夹容量比较大,就把binlog给删了。所以文件里的binlog必须是存在的。也可以配置binlog的失效时间。mysql启
·
诱因
磁盘空间满了,mysql目录下的文件夹容量比较大,就把binlog给删了
出现的问题
mysql启动失败,报错如下
2023-09-11T09:33:00.768047Z 0 [System] [MY-010116] [Server] /usr/libexec/mysqld (mysqld 8.0.32) starting as process 950
2023-09-11T09:33:00.772405Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-09-11T09:33:00.930145Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
mysqld: File './binlog.000027' not found (OS errno 2 - No such file or directory)
2023-09-11T09:33:01.019274Z 0 [ERROR] [MY-010958] [Server] Could not open log file.
2023-09-11T09:33:01.019289Z 0 [ERROR] [MY-010041] [Server] Can't init tc log
2023-09-11T09:33:01.019308Z 0 [ERROR] [MY-010119] [Server] Aborting
2023-09-11T09:33:02.522973Z 0 [System] [MY-010910] [Server] /usr/libexec/mysqld: Shutdown complete (mysqld 8.0.32) Source distribution.
2023-09-11T09:44:12.040987Z 0 [System] [MY-010116] [Server] /usr/libexec/mysqld (mysqld 8.0.32) starting as process 1095
2023-09-11T09:44:12.045486Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-09-11T09:44:12.186842Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
mysqld: File './binlog.000027' not found (OS errno 2 - No such file or directory)
2023-09-11T09:44:12.272703Z 0 [ERROR] [MY-010958] [Server] Could not open log file.
原因
mysql启动的时候会根据binlog.index(有些环境的名字是mysql-bin.index)的内容来选定binlog
所以文件里的binlog必须是存在的
# cat binlog.index
./binlog.000003
./binlog.000004
./binlog.000005
./binlog.000006
./binlog.000007
解决方案
清空binlog.index(有些环境的名字是mysql-bin.index)里的内容,重启mysqld服务就行了
也可以配置binlog的失效时间
# 配置binlog失效时间为3天,也就是只保留最近3天的binlog日志
expire_logs_days = 3
然后重启服务即可
# systemctl restart mysqld
更多推荐
已为社区贡献7条内容
所有评论(0)