• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1810
  • Last Modified:

PostgreSQL Connection Refused


I have installed Postgresql 8.3 successfully on my windows machine. And able to connect to the databases from my machine. But when I try to make connection to it from other machine (Client Installed)
It returns error:
could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host  and accepting TCP/IP connections on port 5432 on Windows

I also made an entry into hba.config file
host    all         all           trust
But this not work

Please advice.
  • 3
  • 2
3 Solutions
earth man2Commented:
see http://www.postgresql.org/docs/8.3/static/runtime-config-connection.html#RUNTIME-CONFIG-CONNECTION-SETTINGS

make sure that


is set in the postgresql.conf file
or specifies your ip addresses of your lan/wan adapter
if that checks out check the firewall settings and allow traffic on port 5432.
The change you described to the HBA config file is insufficient.  The IP address '' is for localhost; _every_ computer will typically have set for themselves.  So if your remote client tries to connect to, it would really be trying to connect to itself.  As the database is not running on the client, the connection attempt will fail.

Assuming your client has an address of '', add the following line to the HBA config file:
host           all               all            md5

If you want to allow access from any host on a network, modify the "32" bitmask to the appropriate setting ("24" for a Class C, for example).  Also, 'md5' will require MD5-hashed passwords to be passed.

Make sure you leave the line you gave, so that you can continue to connect to the database from the server itself.

Check http://www.postgresql.org/docs/8.3/static/auth-pg-hba-conf.html for more details.
Also - run service executable from command line and add firewall exception.
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

/NR ?
Well, of course, I think _my_ answer was the correct solution. ;)

In all seriousness, based on the asker's information, the pg_hba.conf file would have needed a change similar to what I proposed.  However, if that would have been the complete solution or the second part of the complete fix after earthman2's suggested fix for the server connection, we'll never know without sitg.  gheist's firewall suggestion effectively duplicate's earthman2's.

I guess I would recommend the bulk of the points split between earthman2 and myself.  
I agree...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now