I am trying to connect to my postgres database which is install on AWS EC2 instance.
I have installed pgadmin3 on my local ubuntu machine and I am trying to connect my postgres but I am getting error:
reports could not connect to server: Connection refused Is the server running on host "myip" and accepting TCP/IP connections on port 5432?
On aws I have open port 5432.
I edited my postgresql.conf and I added :
listen_addresses = '*'
and inside pg_hba.conf I added this:
host all all 192.168.1.0/24 md5
But now I am getting this error:
FATAL: no pg_hba.conf entry for host "myip", user "postgres", database "postgres", SSL on FATAL: no pg_hba.conf entry for host "myip", user "postgres", database "postgres", SSL off getting this error
I solved this by adding this line to postgresql.conf :
listen_addresses = '*'
file location of postgresql.conf is:
/etc/postgresql/9.5/main/postgresql.conf
And I added this line in file pg_hba.conf:
# IPv4 local connections:
host all all 0.0.0.0/0 md5
host all all 127.0.0.1/32 md5
And restarted postgres service using:
sudo service postgresql restart