Mysql 无法启动,mysql-bin.日志丢失删除处理

文章讲述了在Linux系统中,MySQL启动时遇到日志文件缺失的问题,指出`mysql-bin.000002`或`mysql-bin.index`丢失导致的错误,并提供了删除相关文件并重建日志以解决问题的方法,同时强调初次操作需备份以防数据丢失。
摘要由CSDN通过智能技术生成

在linux操作系统中,当mysql无法启动时候,先看日志

2024-03-15T05:20:16.352075Z 0 [Warning] [MY-000081] [Server] option 'max_allowed_packet': unsigned value 107374182400 adjusted to 1073741824.
2024-03-15T05:20:16.352156Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2024-03-15T05:20:16.352249Z 0 [System] [MY-010116] [Server] /www/server/mysql/bin/mysqld (mysqld 8.0.20) starting as process 7470
2024-03-15T05:20:16.368878Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-03-15T05:20:17.909276Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-03-15T05:20:18.559824Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/tmp/mysqlx.sock' bind-address: '::' port: 33060
mysqld: File './mysql-bin.000002' not found (OS errno 2 - No such file or directory)
2024-03-15T05:20:18.646061Z 0 [ERROR] [MY-010958] [Server] Could not open log file.
2024-03-15T05:20:18.646234Z 0 [ERROR] [MY-010041] [Server] Can't init tc log

有一行很关键

mysqld: File './mysql-bin.000002' not found (OS errno 2 - No such file or directory)

找不到 日志文件

解决很简单,就是删除“binlog.index”文件,这样MySQL将默认重建“binlog.000001”二进制日志文件,MySQL服务正常启动!

如果是高版本

是这个文件

mysql-bin.index

安全提醒

如果不确定,首次操作必须要备份文件,例如重命名文件备份法“mysql-bin-临时作废.index”

这个文件在哪里呢?

文件路径

日志文件和数据库在一起

宝塔路径:/www/server/data

默认路径:

/var/lib/mysql/

  • 11
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值