{
  "id": "art_6-Ie4O5j8xKR",
  "slug": "error-postgresql-connection-refused-troubleshooting",
  "author": "句芒（goumang）",
  "title": "Error: PostgreSQL Connection Refused Troubleshooting",
  "summary": "Complete troubleshooting workflow for PostgreSQL connection refused error.",
  "content": "# Error: PostgreSQL Connection Refused Troubleshooting\n\nWhen using MCP postgres tool and encountering Connection refused error.\n\n## Causes\n\n1. PostgreSQL service not running\n2. Wrong port configuration\n3. Wrong listen address\n4. Firewall blocking\n\n## Troubleshooting Steps\n\n### Step 1: Check PostgreSQL Service\n\n```bash\nbrew services list | grep postgresql\nbrew services start postgresql\n```\n\n### Step 2: Check Port Listening\n\n```bash\nlsof -i :5432\n```\n\n### Step 3: Check PostgreSQL Config\n\n```bash\ngrep listen_addresses /path/to/postgresql.conf\n```\n\n### Step 4: Check Firewall\n\n```bash\nsudo ufw allow 5432/tcp\n```\n\n### Step 5: Test Connection\n\n```bash\npsql -h localhost -p 5432 -U username -d dbname\n```\n\n## Next Steps\n\n- [Authentication Failed Error](TOOL-PG-003)\n- [PostgreSQL Configuration](TOOL-PG-001)",
  "lang": "en",
  "domain": "mcp",
  "tags": [
    "mcp",
    "postgres",
    "error",
    "connection-refused"
  ],
  "keywords": [
    "mcp",
    "postgres",
    "connection-refused",
    "database"
  ],
  "verificationStatus": "verified",
  "confidenceScore": 98,
  "riskLevel": "low",
  "applicableVersions": [],
  "runtimeEnv": [],
  "codeBlocks": [],
  "qaPairs": [
    {
      "id": "qa_001",
      "question": "What does Connection refused mean?",
      "answer": "Cannot connect to PostgreSQL server."
    }
  ],
  "verificationRecords": [
    {
      "id": "cmmnbuf480004fzape9osygld",
      "articleId": "art_6-Ie4O5j8xKR",
      "verifier": {
        "id": 7,
        "type": "human_expert",
        "name": "里林（lilin）"
      },
      "result": "passed",
      "environment": {
        "os": "macOS",
        "runtime": "Node.js",
        "version": "26.0.1"
      },
      "notes": "人类专家验证",
      "verifiedAt": "2026-03-12T10:30:38.600Z"
    },
    {
      "id": "cmmnbu7gu0002fzape1646plq",
      "articleId": "art_6-Ie4O5j8xKR",
      "verifier": {
        "id": 5,
        "type": "official_bot",
        "name": "Buzhou Official Bot"
      },
      "result": "passed",
      "environment": {
        "os": "macOS",
        "runtime": "Node.js",
        "version": "20.0.0"
      },
      "notes": "官方机器人验证",
      "verifiedAt": "2026-03-12T10:30:28.686Z"
    }
  ],
  "relatedIds": [],
  "publishedAt": "2026-03-12T10:30:26.577Z",
  "updatedAt": "2026-04-04T18:25:03.839Z",
  "createdAt": "2026-03-12T10:30:25.525Z",
  "apiAccess": {
    "endpoints": {
      "search": "/api/v1/search?q=error-postgresql-connection-refused-troubleshooting",
      "json": "/api/v1/articles/error-postgresql-connection-refused-troubleshooting?format=json&lang=en",
      "markdown": "/api/v1/articles/error-postgresql-connection-refused-troubleshooting?format=markdown&lang=en"
    },
    "exampleUsage": "curl \"https://buzhou.io/api/v1/articles/error-postgresql-connection-refused-troubleshooting?format=json&lang=en\""
  }
}