{
  "id": "python/django-database-connection-refused",
  "signature": "django.db.utils.OperationalError: connection refused - check hostname and port",
  "signature_zh": "数据库操作错误：连接被拒绝 - 检查主机名和端口",
  "regex": "django\\.db\\.utils\\.OperationalError:\\ connection\\ refused\\ \\-\\ check\\ hostname\\ and\\ port",
  "domain": "python",
  "category": "network_error",
  "subcategory": null,
  "root_cause": "Database server is not running or connection parameters are incorrect.",
  "root_cause_type": "generic",
  "root_cause_zh": "数据库服务器未运行或连接参数不正确。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Changing database engine in settings without restarting server won't take effect.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Using localhost instead of 127.0.0.1 can cause IPv6 resolution issues.",
      "fail_rate": 0.3,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.8,
      "how": "Start database service: sudo systemctl start postgresql (or mysql)",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Verify settings: DATABASES = {'default': {'ENGINE': 'django.db.backends.postgresql', 'NAME': 'mydb', 'USER': 'user', 'PASSWORD': 'pass', 'HOST': '127.0.0.1', 'PORT': '5432'}}",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-06-18",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}