Enabling Remote Connection on PostgreSQL
Default Postgresql configuration only allow connection from localhost, if you want your PostgreSQL to accepting connection from other ip, there are some changes that you need to do.
First, you need to open file pg_hba.conf and edit “IPv4 local connections” part. Add other ip that you want to be connected to your database.
# IPv4 local connections: host all all 127.0.0.1/32 trust host all all 192.168.1.0/16 trust
After that, open file postgresql.conf and do some editing in “listen_addresses” part.
#listen_addresses = 'localhost' # what IP address(es) to listen on; listen_addresses = '*' # comma-separated list of addresses; # defaults to 'localhost', '*' = all # (change requires restart)
After restarting your postgresql , it can accept connection from other ip.
No Comments