Trouble connecting to a PostgreSQL Database? no pg_hba.conf entry for host "192.168.57.76", no encrpytion

All we need is an easy explanation of the problem, so here it is.

I have a computer I was just given that is hosting a PostgreSQL 14 database on it. On my local computer I have just freshly installed PgAdmin 4.

On PgAdmin, I made a new server group named after the customer I am doing work for and then am attempting to connect to this server. I am entering my credentials

Trouble connecting to a PostgreSQL Database? no pg_hba.conf entry for host "192.168.57.76", no encrpytion

and

Trouble connecting to a PostgreSQL Database? no pg_hba.conf entry for host "192.168.57.76", no encrpytion

But I keep getting the error as shown in the bottom of my second picture – Unable to connect to server: connection to server at "192.168.57.60" port 5432 failed: FATAL: no pg_hba.conf entry for host "192.168.57.76", user "root", database "PostgreSQL 14", no encrpytion

I have found other stack overflows regarding a similar message saying no SSL, and requiring changes and I do already have

listen_addresses = '*' in my postgresql.conf
and

host all all      ::1/128      scram-sha-256
host all postgres 127.0.0.1/32 scram-sha-256

in pg_hba.conf.

I don’t know what else to change or to fix. What am I missing here to connect?

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

You need tu allow connections from the machine where pgAdmin runs. In pg_hba.conf, add a line like

host  all  username  192.168.0.0/16  scram-sha-256

Then reload or restart PostgreSQL (the latter is necessary if you change listen_addresses), and there should be an improvement.

Note that the database user is almost certainly not called root, and the database almost certainly not PostgreSQL 14. I don’t know what choices you made when you setup PostgreSQL, but try postgres for both.

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply