2

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.

  • Can you connect it from the command line? psql --host=your.azure.ip --port=5432 --user=yourUserName? I suspect a pgadmin misconfiguration is more likely. – peterh Jun 10 '18 at 17:05
  • Same error comes up. I also added local all all md5 before testing this. When i change user on the machine to by "su postgres" and just write psql it works – user3213378 Jun 10 '18 at 17:22
  • Then my second most likely reason is that the DB is using actually a different pg_hba.conf, not the one you are editing. – peterh Jun 10 '18 at 17:27
  • The changes you've wrote should make it working. It is a highly misterious problem for me. What is in /var/log/postgresql ? – peterh Jun 10 '18 at 17:28
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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