If you’re reading this at 11:00 PM because your deployment logs are screaming no pg_hba.conf entry for host, stop pasting random snippets. This error is three distinct architectural problems dressed in the same message, and the fix depends entirely on where your database lives. Let’s solve it permanently, securely, and right now.
TL;DR: The client IP, user, and database combination doesn’t match any rule in the active pg_hba.conf. Find the file with SHOW hba_file;, add a line that matches your actual connection parameters, and reload with SELECT pg_reload_conf();. Which line you add depends entirely on whether you’re on your dev machine, inside Docker, or on a managed cloud. Jump to the scenario that matches your situation:
- Local development (socket vs. TCP)
- Docker / docker‑compose
- Managed cloud (RDS, Cloud SQL, Azure, Neon, Supabase)
Stop blindly pasting host all all 0.0.0.0/0 trust; that’s how you end up on a 2 a.m. page.
Decoding the Error
The full error tells you exactly why the connection was rejected:
FATAL: no pg_hba.conf entry for host "192.168.1.105", user "app_prod", database "customers", SSL off
Every piece in that message is a filter condition that PostgreSQL walked through in pg_hba.conf and failed to match:
- Host: The client’s IP address as the server sees it. If you think you’re connecting from localhost but the IP says otherwise, your network stack is lying to you.
- User: The database role requested by the client.
- Database: The database it asked for.
-
SSL: Whether the connection was encrypted (
hostlines match both, whilehostssl/hostnosslnarrow that down).
No match means zero lines in pg_hba.conf have
Top comments (0)