unable to connect to server for Postgres

On windows, Just go to the 'Services'. Start/Restart the postgresql-X64 service. It worked for me as my service was in stopped state somehow.


There are two items to configure if your server isn't on localhost:

  • find your postgresql.conf and add your server's public IP address to the end of the setting listen_addresses (separate multiple entries by commas); uncomment the line if it is commented out (e.g. with '#')
  • add a line to pg_hba.conf containing your client's IP address - you may copy the line containing 127.0.0.1 and change only the IP address

On Ubuntu, these files are in /etc/postgresql/<version>/main/.


In my case I couldnt' open the pgAdmin4, for some reason. I use Postgresql 10 and pgAdmin4

The port in the postgresql.conf was not the same as in the pgAdmin4 --> postgreSQL 10 --> properties --> Connection --> port.

I fixed it and it worked. Check if those 2 are in line.


First press win key+R Search for services.msc A window will open in that find postgresql-x64-13 and open that, in that tab click start option For me its works perfectly.