I am trying to use pgAdmin to connect to a Postgresql server hosted by Elephantsql. However, I keep getting the error no pg_hba.conf entry for host
:
no pg_hba.conf entry for host "173.18.54.553", user "db_user", database "db_name", SSL on FATAL: no pg_hba.conf entry for host "xxx.xx.xxx.xxx", user "hcexhbhx", database "postgres", SSL off
After doing some research, I edited my pg_hba.conf
file:
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
host all all 173.66.143.244/24 md5 (new entry)
host all all 0.0.0.0/0 md5 (new entry)
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication uzrrrrd trust
#host replication uzrrrrd 127.0.0.1/32 trust
#host replication uzrrrrd ::1/128 trust
And I added a line to my postgres.conf
file:
listen_addresses='*'
And I restarted postgresql before attempting to connect again.
However, I'm still getting the no pg_hba.conf entry for host
error.
Does anyone know what I might be doing wrong?
Thank in advance!
Best Answer
You're editing the wrong
pg_hba.conf
, connect locally withpsql
and run thisThen from outside edit that file. Perhaps you have two versions of PostgreSQL or you built your own. Or, you're restarting the wrong PostgreSQL. Perhaps make sure you're restarting the right one by connecting, again locally over psql, and running
Make sure you're editing the
pg_hba.conf
on the SERVER you're trying to connect to and not the CLIENT. (per @joanolo)