PostgreSQL · error reference
PostgreSQL: no pg_hba.conf entry for host
FATAL: no pg_hba.conf entry for host "203.0.113.7", user "app", database "shop", no encryption
The server reached its access rules and none of them allows this client, user and database — over the encryption the client chose. The last two words are often the whole answer.
What the database is telling you
pg_hba.conf is PostgreSQL's list of who may connect from where, and how. It is read top to bottom; the first line whose connection type, database, user and address all match decides. When none matches, the server refuses before asking for a password. "no encryption" means the client connected without SSL — and a server that only has hostssl lines for remote clients will refuse exactly that.
Why it shows up in a migration
Managed PostgreSQL services (RDS with rds.force_ssl, Azure, Cloud SQL, Supabase) accept remote clients only over SSL, and self-hosted servers usually list only the application's subnet. A migration connecting from a new address, without SSL, matches neither.
Common causes
- The server requires SSL for remote clients, and the client connected with sslmode=disable or a driver default that does not use SSL.
- There is no line for this client's address at all.
- A line exists but for another database or user (or is shadowed by an earlier reject line).
- pg_hba.conf was edited but never reloaded.
How to fix it
- 1
If the message says "no encryption" and the server has hostssl lines, connect with SSL — this is the fix on every managed service.
postgresql://app@db.example.com:5432/shop?sslmode=require
- 2
Otherwise add a line for the client (as narrow as you can), then reload. Lines are matched top to bottom.
-- pg_hba.conf hostssl shop app 203.0.113.7/32 scram-sha-256 SELECT pg_reload_conf();
- 3
See the rules the server actually loaded, and any that failed to parse (superuser).
SELECT line_number, type, database, user_name, address, auth_method, error FROM pg_hba_file_rules;
What DBShifts does about it
Connection diagnosis reads this message as TLS required and suggests SSL mode Require, which is the fix when the server has hostssl lines for remote clients. When there is no line for DBShifts' address at all, only the database's administrator can add one; the address to add is the one the diagnosis names.
Connection diagnosis
Connecting a database?
Add the database to DBShifts and the connection is tested on the spot. If it fails, you get which of these errors it is and what to change — not the driver's raw message. Once it connects, browse it, migrate it, or let an AI agent read it through the gateway with sensitive columns masked.