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          trust
host 	all 		all 		  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

Leave a Comment

Please be polite. We appreciate that.
Your email address will not be published and required fields are marked