Mysql 无法启动,mysql-bin.日志丢失删除处理
在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/
————————————————
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/cybersnow/article/details/136737864