Postgresql – When trying to connect to an external postgres database using pgAdmin, I get an error

azure-vmpgadmin-4postgresqlUbuntu

I get the following error when trying to connect:

"FATAL: no pg_hba.conf entry for host "", user "postgres", database "postgres", SSL off"

The db is installed on an Ubuntu machine in Azure. I have allowed inbound connections on port 5432, so there should be no issue there however.

I have edited and added the following lines to the /etc/postgresql/9.5/main/pg_hba.conf file on the server:

host all all 0.0.0.0/0 md5
hostssl all all 0.0.0.0/0 md5

even when I tried to change the mode to trust, I couldn't get a connection established.

I also edited the listen addresses to be: "listen_addresses = '*'" in /etc/postgresql/9.5/main/postgresql.conf.

I have ran the command service postgresql restart after making each of the changes.

Best Answer

The cause of the is the bold part, the host "":

"FATAL: no pg_hba.conf entry for host "", user "postgres", database "postgres", SSL off"

The database, from which you get the error, see a local connection, and not a networked one.

How can it happen, it depends on your system configuration, what you didn't share here.