I have PostgreSQL version 9.5 installed at my machine (Windows 7 Enterprise x64 bit version). I have several databases in schema 'public'. I would like to use/access one of these databases from another machine (Windows 7) using LAN connectivity (so that this database may act as a shared database between two machines). I was wondering whether is it possible to do through "listen_addresses" option in postgresql.conf dialogue window? If not, is there any alternative way to do this?
2 Answers
Read the article Configuring PostgreSQL to Accept Connections From Computers on Your Network where it is explained with screen shots.
Yes, two things that need to happen:
- Your database must be listening on a port and ip to external connections. For this you need to modify
postgresql.conf
, you may choose to use the new-ish method ofALTER SYSTEM
to do that. - Your database must be properly configured to authenticate someone coming in externally. To do this you must add a host or preferably
hostssl
entry inpg_hba.conf
for that ip/port.
pg_hba.conf
: postgresql.org/docs/current/static/auth-pg-hba-conf.html