# 错误：中继日志读取失败：无法解析中继日志事件。从服务器已停止。Last_IO_Error：读取中继日志事件错误：中继日志读取失败

- **ID:** `database/mysql-slow-replica-lag-bytes-behind`
- **领域:** database
- **类别:** data_error
- **错误码:** `1594`
- **验证级别:** ai_generated
- **修复率:** 75%

## 根因

MySQL 中继日志损坏或被截断，通常是由于磁盘 I/O 错误或复制过程中服务器意外关闭。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| MySQL 5.7 | active | — | — |
| MySQL 8.0 | active | — | — |
| MySQL 8.4 | active | — | — |

## 解决方案

1. ```
   STOP SLAVE; RESET SLAVE; CHANGE MASTER TO ...; START SLAVE; (reinitialize replication from scratch using SHOW SLAVE STATUS to get the correct master log file and position, or use GTID if enabled)
   ```
2. ```
   STOP SLAVE; SET GLOBAL relay_log_purge=0; START SLAVE; (if the error is transient, this may skip the bad event but risks data inconsistency)
   ```

## 无效尝试

- **Restart the MySQL replica service without fixing the relay log** — The corrupted relay log persists and will be re-read, causing the same error immediately. (95% 失败率)
- **Manually delete relay log files and restart replication without resetting** — MySQL still expects the relay log index to reference the deleted files, leading to further errors. (80% 失败率)
