TK-95
TK-95

Reputation: 1170

Unable to connect postgres DB remotely

Every time, when I try to connect to remote Postgres DB, I receive error:

 no pg_hba.conf entry for host "159.224.92.121", user "xpkzxqrkisdrjd", database "d92na0gp4bdq4", SSL off

I googled it and found that two config files should be updated.

Should append:

pg_hba.conf

host all all 0.0.0.0/0 md5

postgresql.conf

listen_addresses = '*'

I did it, but error still occurs, when I try to connect to remote DB. Local DB work fine.

Any ideas?

UPDATE

Maybe it will be useful. I have installed postgres using homebrew. For restarting postgres server I use:

brew services postgres restart

Upvotes: 0

Views: 703

Answers (2)

TK-95
TK-95

Reputation: 1170

So, I continued to google this issue and finally found the answer. You should use SSL option.

Please, check this link: https://intellij-support.jetbrains.com/hc/en-us/community/posts/205996299/comments/206373089

Upvotes: 0

Laurenz Albe
Laurenz Albe

Reputation: 246473

Two items to help you on the way:

  • pg_hba.conf is processed from top to bottom, so if the incoming connection matches an earlier line, that entry will be used.

  • Set log_connections = on in postgresql.conf and reload. Then, after a connection attempt has failed, look into the log file for the reason. Recent PostgreSQL versions will also tell you which pg_hba.conf line was used.

Upvotes: 1

Related Questions