{
  "id": "database/mysql-replica-lag-binlog-not-purged",
  "signature": "ERROR 1794 (HY000): Slave is not configured or failed to initialize properly. You must at least set --server-id to enable either a master or a slave.",
  "signature_zh": "错误 1794 (HY000): 从库未正确配置或初始化失败。您必须至少设置 --server-id 以启用主库或从库。",
  "regex": "ERROR 1794 \\(HY000\\): Slave is not configured or failed to initialize properly",
  "domain": "database",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "MySQL replication slave fails to start because the server-id is not set or is set to 0, which is required for replication to function.",
  "root_cause_type": "generic",
  "root_cause_zh": "MySQL 复制从库无法启动，因为未设置 server-id 或设置为 0，而复制功能要求必须设置该参数。",
  "versions": [
    {
      "version": "MySQL 8.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "MySQL 5.7",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "MariaDB 10.5",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Restarting the MySQL service without changing configuration",
      "why_fails": "The server-id remains 0 or unset after restart; the error persists.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "Setting server-id to 0 explicitly in my.cnf",
      "why_fails": "MySQL ignores server-id=0 and still requires a positive integer value.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Resetting replication with RESET SLAVE without fixing server-id",
      "why_fails": "RESET SLAVE clears replication state but does not change the server-id; error returns on next START SLAVE.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Set server-id to a unique positive integer (e.g., 1) in my.cnf under [mysqld] section, then restart MySQL:\n[mysqld]\nserver-id=1",
      "success_rate": 0.95,
      "how": "Set server-id to a unique positive integer (e.g., 1) in my.cnf under [mysqld] section, then restart MySQL:\n[mysqld]\nserver-id=1",
      "condition": "",
      "sources": []
    },
    {
      "action": "If MySQL is already running, set server-id dynamically (requires restart for full effect, but can be set at runtime in MySQL 8.0+):\nSET GLOBAL server_id = 1;\nThen restart the service.",
      "success_rate": 0.85,
      "how": "If MySQL is already running, set server-id dynamically (requires restart for full effect, but can be set at runtime in MySQL 8.0+):\nSET GLOBAL server_id = 1;\nThen restart the service.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Set server-id to a unique positive integer (e.g., 1) in my.cnf under [mysqld] section, then restart MySQL:\n[mysqld]\nserver-id=1",
    "If MySQL is already running, set server-id dynamically (requires restart for full effect, but can be set at runtime in MySQL 8.0+):\nSET GLOBAL server_id = 1;\nThen restart the service."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://dev.mysql.com/doc/refman/8.0/en/replication-options.html#option_mysqld_server-id",
  "official_doc_section": null,
  "error_code": "1794",
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.95,
  "resolvable": "true",
  "first_seen": "2023-09-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}