{
  "id": "database/mysql-binary-log-corruption",
  "signature": "ERROR 1220 (HY000): Error when executing command 'SHOW BINARY LOGS': binary log file 'mysql-bin.000123' is corrupted",
  "signature_zh": "ERROR 1220 (HY000): 执行命令'SHOW BINARY LOGS'时出错：二进制日志文件'mysql-bin.000123'已损坏",
  "regex": "binary log file '.*' is corrupted",
  "domain": "database",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "MySQL binary log file is corrupted due to disk failure, unexpected shutdown, or incomplete write, preventing replication or log inspection.",
  "root_cause_type": "generic",
  "root_cause_zh": "MySQL二进制日志文件因磁盘故障、意外关闭或不完整写入而损坏，阻止了复制或日志检查。",
  "versions": [
    {
      "version": "MySQL 8.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "MySQL 8.4",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "MySQL 9.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "MariaDB 10.11",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "MariaDB 11.4",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Delete all binary log files and restart MySQL.",
      "why_fails": "This breaks replication if replicas rely on those logs; it also removes forensic evidence. Use PURGE BINARY LOGS instead.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Ignore the corrupted log and continue without fixing replication.",
      "why_fails": "Replication will stall at the corrupted log file; the replica will not apply further changes until the issue is resolved.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Skip the corrupted binary log file on the replica by setting the next log position. Example: STOP SLAVE; CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000124', MASTER_LOG_POS=4; START SLAVE;",
      "success_rate": 0.7,
      "how": "Skip the corrupted binary log file on the replica by setting the next log position. Example: STOP SLAVE; CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000124', MASTER_LOG_POS=4; START SLAVE;",
      "condition": "",
      "sources": []
    },
    {
      "action": "If the corruption is isolated, use mysqlbinlog to extract events up to the corruption point: mysqlbinlog --stop-position=123456 mysql-bin.000123 > partial.sql; then apply the partial log to the replica.",
      "success_rate": 0.75,
      "how": "If the corruption is isolated, use mysqlbinlog to extract events up to the corruption point: mysqlbinlog --stop-position=123456 mysql-bin.000123 > partial.sql; then apply the partial log to the replica.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Purge the corrupted binary log file after ensuring all replicas have caught up: PURGE BINARY LOGS TO 'mysql-bin.000124'; Then reset the master log: RESET MASTER;",
      "success_rate": 0.8,
      "how": "Purge the corrupted binary log file after ensuring all replicas have caught up: PURGE BINARY LOGS TO 'mysql-bin.000124'; Then reset the master log: RESET MASTER;",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Skip the corrupted binary log file on the replica by setting the next log position. Example: STOP SLAVE; CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000124', MASTER_LOG_POS=4; START SLAVE;",
    "If the corruption is isolated, use mysqlbinlog to extract events up to the corruption point: mysqlbinlog --stop-position=123456 mysql-bin.000123 > partial.sql; then apply the partial log to the replica.",
    "Purge the corrupted binary log file after ensuring all replicas have caught up: PURGE BINARY LOGS TO 'mysql-bin.000124'; Then reset the master log: RESET MASTER;"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://dev.mysql.com/doc/refman/8.0/en/binary-log.html",
  "official_doc_section": null,
  "error_code": "1220",
  "verification_tier": "ai_generated",
  "confidence": 0.84,
  "fix_success_rate": 0.72,
  "resolvable": "partial",
  "first_seen": "2024-11-01",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}