I want to be able to connect from any PC anywhere to my Database.


  1. OS: Windows 10
  2. PostgreSQL: 12.0

Currently all Tutorials say the same: (Thats what i also did)

  1. Change listen_addresses to listen_addresses = '*' in the postgresql.conf
  2. Add host all all md5 in the pg_hba.conf

But they don't say how to connect from the Client Side and they don't pinpoint how secure it is to do so.

Let's say at the Host I Did the above steps and restarted. I created a Database called TablesTest.

How do I connect to this database at the Client? How secure is it?

  • What client do you want to connect from? Did you assign a good password to the user?
    – jjanes
    Oct 6, 2019 at 13:59
  • @jjanes I want to be able to install postgresql at any PC with pgadmin and then connect to the database(hosted at another PC).
    – Ojav
    Oct 6, 2019 at 14:04

1 Answer 1


How to connect should be trivial: fill the appropriate values into the pgAdmin dialog (host, port, user, database). If I remember correctly, pgAdmin calls the database "administrative database" or similar.

This is fairly secure, if you want to do better, here are some ideas:

  • Use the scram-sha-256 authentication method rather than md5. This requires that you change password_encryption to scram-sha-256 on the server and assign a new password to the user.

  • Limit the pg_hba.conf entry so that only one user can connect to one database from a single host, for example

    host databasename username scram-sha-256
  • For better security, don't allow remote connections as a superuser.

  • For transport security, you can enable SSL connections. Without that, the communication between database client and database server is unencrypted.

  • Im sry to ask this stupid question but can you "How to connect should be trivial" explain this trivial part what is my host is it my Ip v4 etc..?
    – Ojav
    Oct 11, 2019 at 14:16
  • host is any name that can be used to establish a TCP connection to the database server machine: host name or IP address. Anything that works with ping. Oct 12, 2019 at 17:55

Your Answer

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

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