I have a problem to connect server for Postgres after I updated my windows.Before I update there is no problem to open the database. My database in Postgres also gone. When I want to create my new database it show this error:
Unable to connect to server: could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?
First, double check that the Postgres process is running where you expect it to be. If you are trying to connect to a Postgres instance on the same host as your terminal, you can run lsof -p :5432 which will show which, if any, processes are listening on that port. The postgres process should be connected there.
A Connection Timed Out error occurs when the database's firewall won't allow you to connect to the database from your local machine or resource. If you are getting this error, check that you have added the machine or resource you are connecting from to the database's list of trusted sources.
If pgAdmin displays this message, there are two possible reasons for this: the database server isn't running - simply start it. the server isn't configured to accept TCP/IP requests on the address shown.
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:
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 '#')pg_hba.conf
containing your client's IP address - you may copy the line containing 127.0.0.1 and change only the IP addressOn 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With