1

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

enter image description here

and

enter image description here

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?

5
  • 1
    If that's the entire contents of pg_hba.conf, you're missing the entry that allows you to connect to the database from a remote host (just like the error message is telling you).
    – mustaccio
    Commented Jul 14, 2022 at 15:11
  • That's not the entire contents, thats just what I saw was relevant in other stack overflow posts so I wanted to let that be known it is already there. What should I look for or add to allow remote hosts? Commented Jul 14, 2022 at 15:15
  • 1
    Also, the actual database name you want to connect to is unlikely to contain spaces, so PostgreSQL 14 isn't right.
    – mustaccio
    Commented Jul 14, 2022 at 15:19
  • I checked the server name and it does in fact have a space. I don't know if that complicates things. Commented Jul 14, 2022 at 15:23
  • Nevermind, I guess PostGreSQL 14 is what first appears under Servers but underneath that I do see the actual database names. Thank you, that is one thing I need to change. Commented Jul 14, 2022 at 15:27

1 Answer 1

2

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.

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.