Report this

What is the reason for this report?

PSQL connection is failing from trusted IP with the message no pg_hba.conf entry for host

Posted on December 11, 2024

Hi. I copy/pasted the psql connection string for my managed database from the managed database dashboard. I have my public-facing IP address as a Trusted Source.

When executing the psql command I get this reponse:

psql: error: connection to server at <DB HOST> (<DB HOST IP), port <DB PORT> failed: could not initiate GSSAPI security context:  The operation or option is not available: Credential for asked mech-type mech not found in the credential handle
connection to server at <DB HOST> (<DB HOST IP), port <DB PORT> failed: SSL error: certificate verify failed
connection to server at <DB HOST> (<DB HOST IP), port <DB PORT> failed: FATAL:  no pg_hba.conf entry for host "<MY TRUSTED IP>", user "<MY DB USER>", database "<MY DATABASE>", no encryption

I have installed the CA Certificate locally.

What am I missing?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there,

Can you share the exact psql command that you are using to connect?

Usually the following should work when using the CA certificate:

PGPASSWORD=your_password psql -U doadmin -h cluster-do-user-1234567-0.db.ondigitalocean.com -p 25060 -d defaultdb --set=sslmode=require --set=sslrootcert=path/to/your-ssl.crt

Also can you confirm how did you install the certificate and what is the exact OS that you are using locally?

Besides that, what is the exact psql CLI version that you are using?

- Bobby

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.