Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to remotely connect to my postgresql database. I have two virtual machines set up both running ubuntu 14.04. I am trying to connect to the second vm using the first vm using

psql -h 10.0.1.23 -U postgres -d postgres

But I receive the error:

Could not connect to server: Connection refused
    Is the server running on host "10.0.1.23" and accepting
    TCP/IP connections on port 5432?

I have changed the pg_hba.conf and added

host all all 10.0.1.64/24 md5
host all all * md5
host all all 0.0.0.0/0 md5

And changed the postgresql.conf listen_address=" * "

In an attempt to allow all incoming connections. I have also tried to change the firewall settings, but I am unsure of whether or not the ports are properly listening for the connection.

share|improve this question

migrated from stackoverflow.com Oct 5 '14 at 8:02

This question came from our site for professional and enthusiast programmers.

1  
Hi Jonathan! Welcome to Stack Overflow! Here most of the questions are related with development, you may probably want to try this question on a community like SuperUser. – Alpha Aug 19 '14 at 20:33

Apparently the problem was in the postgresql.conf the listen_addresses line had the # still in front of it making it a comment. Removing it solved my problems.

share|improve this answer
    
# symbol (comment) wasted around 3 hours of mine while allowing other computers to connect to it. Thanks for your answer. It helped to fulfill the task. – vivek Jul 26 '16 at 10:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.