7

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!

1 Answer 1

7

You're editing the wrong pg_hba.conf, connect locally with psql and run this

SHOW hba_file;

Then 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

SELECT pg_reload_conf();

Make sure you're editing the pg_hba.conf on the SERVER you're trying to connect to and not the CLIENT. (per @joanolo)

2
  • 2
    For the sake of completeness: it should be pointed out that the hba_file lives on the server [probably virtual] machine, not the client.
    – joanolo
    Commented Jan 14, 2017 at 23:14
  • @joanolo valid point. Commented Jan 14, 2017 at 23:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.