We have issues connecting to our PostgreSQL server. Sometimes nobody can connect, sometimes some can and some can't. We have no idea why.

The PostgreSQL server is on a virtual machine with 4GB of memory. We have 3 poeple who want to connect to that server. Could it be possible that number of connections are over the default max_connection?

Error message:

could not connect to server: Connection refused Is the server running on host "192.x.x.x" and accepting TCP/IP connections on port 5432?

  • 1
    Network problems, by the sounds. Show the exact text of the error message(s) you get please. Sep 18, 2015 at 9:41
  • Network, firewall, ... Can you ping the DB host when the connection is unsuccessful (and can you when it succeeds)? Sep 18, 2015 at 9:59
  • This error is not due to too many connections, it's network problems like others have mentioned. Sep 18, 2015 at 12:24
  • Thank you all.Today the db is normal.I think it's really network problem as you said Sep 21, 2015 at 4:54

2 Answers 2


This sounds to me like a network problem, restart the virtual machine and try again. The whole vm might be needing just a restart.


It sounds like you might have network issues, although withojt further details specifying the "sometimes" when your connection does work, it's hard to tell. It could be something like your server is not configured to listen on that specific network interface (check pg_hba.conf and make sure, like the manual entry in this link explains) or you might have some other piece of software interfering, such as a firewall. Maybe the times when the connection does work somehow trigger a different rule, which allows them to connect.

As other answers state, a reboot might be a good starting point, but if you haven't done anything weird regarding network config I doubt that will fix it.

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.