Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I got a tiny problem regarding connection to my server. What should we do when this message appears in front of you?

enter image description here

I've done several changes in the *pg_hba.conf* entry but yet to succeed. Any careless mistake from my side?

Thanks in advance. I love this sentence.

share
1  
Migrate this to SuperUser? –  Sean Aug 12 '11 at 12:41
1  
@zearth are you intending to use postgis with postgres - if yes it is a GIS related question. –  Mapperz Aug 12 '11 at 13:50
    
@Mapperz Of course. –  zearth Aug 16 '11 at 2:02

4 Answers 4

Assuming you network is secure:

# Allow a user from host 192.168.0.100 to connect to database
# "postgres" if the user's password is correctly supplied.
# 
# TYPE  DATABASE    USER        IP-ADDRESS          METHOD
host    postgres    all         192.168.0.100          md5

http://www.postgresql.org/docs/8.2/static/auth-pg-hba-conf.html#EXAMPLE-PG-HBA.CONF

share
1  
With that format, an IP-mask must follow the IP-ADDRESS. Or you could just use a single CIDR-address of 192.168.0.100/32. –  Mike T Aug 12 '11 at 3:16

If you make any changes to the configuration files (most notably pg_hba.conf), you need to signal the database server to reload. If your database server is on a Windows computer, this is likely in the start menu:

Start > PostgreSQL 9.0 > Reload Configuration

or if it is on a POSIX system (Linux, Mac OS X, etc.), the direct way is with pg_ctl reload [-s] [-D datadir], or some other convenient service wrapper, e.g. if you install via YUM from http://www.pgrpms.org/:

service postgresql-9.0 reload

The result from either Windows or POSIX reload should show a helpful message, like:

server signaled

If there are problems with your pg_hba.conf file, they should appear here.

share

Besides the pg_hba.conf settings, you may want to look at listen_addresses from your postgresql.conf file.

http://www.cyberciti.biz/tips/postgres-allow-remote-access-tcp-connection.html

share
2  
but the message above shows that the database is listening to (and rejecting) connections –  Mike T Aug 12 '11 at 8:56
    
start using the "trust" method which should allow you to connect no matter what and then work your way up. Can you connect locally with host all all 127.0.0.1/32 trust ? –  Ragi Yaser Burhum Aug 12 '11 at 16:58

I went through similar problem. I was able to fix it by editing the pg_hba.config file and adding another entry immediately after the default one for the remote machine ipaddress range. I basically copied the default one and just changed the database, user, CIDR-ADDRESS and METHOD information. I reloaded the config file from start menu (start/postgres x.x/reload configuration). This solved my problem. like this:

IPv4 local connections:

host all all *.0.0.*/32 trust (default one)

IPv4 local connections:

host zigag gisuser 172.05.003.12/32 trust

share

This site is currently not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .