My postgresql 9.4 is installed in centos 6.7,and I have followed this: http://www.cyberciti.biz/faq/postgresql-remote-access-or-connection/
1,cd /usr/pgsql-9.4/share/ 2,cp postgresql.conf.sample postgresql.conf 3,sudo vi postgresql.conf and add two lines,and save it: > *listen_addresses = "*"tcpip_socket = true* 4,cp pg_hba.conf.sample pg_hba.conf 5,sudo vi pg_hba.conf then *commented(maybe this is uneccessary)* > #host all all 127.0.0.1/32 > @authmethodhost@ > #host all all ::1/128 > @authmethodhost@ 6,add two lines:(I have tried to change *md5 to trust*,neither works) > > *host all all 0.0.0.0/0 <http://0.0.0.0/0> > md5host all all ::0/0 > md5* 7,then *save*:pg_hba.conf 8,then *restart* postgresql sever by * sudo service postgresql-9.4 restart* 9.*close iptables* * sudo service iptables stop* 10,and ask another guy in *different city* to try to connect by psql -U postgres -h *135.211.67.23* He got error > > > *psql: could not connect to server: Connection refusedIs the server > running on host "135.211.67.23" and acceptingTCP/IP connections on port > 5432?* and I tried to run same some command in the host(centos),got same error. 12.Running: "netstat -lputn" in the host got ..... tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN - .... So,How to solve this problem?