PostgreSQL: SSL connection is required
FATAL: SSL connection is requiredThe server requires an encrypted connection, and your client connected without one, or without a required client certificate. Set sslmode=require (or verify-full) in your connection string.
What this error means
Many servers, especially managed Postgres on RDS, Cloud SQL, Azure, and Heroku, only accept SSL connections. If your client connects in plaintext, or without a required client certificate, the server refuses it.
On self-managed Postgres this comes from a hostssl rule in pg_hba.conf that has no plaintext fallback.
How to fix it
Your client connects without SSL
Turn SSL on in the connection string.
postgresql://user@host:5432/db?sslmode=requireThe server verifies a client certificate
Provide the client certificate and key.
postgresql://user@host:5432/db?sslmode=verify-full&sslcert=client.crt&sslkey=client.key&sslrootcert=ca.crtLocal development only
If you want plaintext in dev, change the pg_hba rule from hostssl to host and reload. Do this only in development.
How to avoid it next time
- Default to sslmode=require for any connection over a network.
- Use verify-full with the provider CA certificate in production.
Frequently asked questions
Which sslmode should I use?
require encrypts the connection. verify-full also checks the server certificate against a CA, which is what you want in production.
Why does my managed database demand SSL?
Providers like RDS and Cloud SQL enforce SSL to protect data in transit. Set sslmode=require and supply the provider CA certificate.
Stop struggling with SQL
Use FluentDB, the AI database client for macOS.
Related errors
Part of the PostgreSQL error reference. Last reviewed 2026-07-31.