I have PostgreSQL 9.2 Installed in Windows 7 and I have windows XP installed in Virtual Machine, how do I connect these two databases and allow remote access to add/edit the database from both Systems ?
This question is related to
windows
postgresql
virtual-machine
You have to add this to your pg_hba.conf and restart your PostgreSQL.
host all all 192.168.56.1/24 md5
This works with VirtualBox and host-only adapter enabled. If you don't use Virtualbox you have to replace the IP address.
This is a complementary answer for the specific case of you using AWS cloud computing (either EC2 or RDS machines).
Besides doing everything proposed above, when using AWS cloud computing you will need to set you inbound rules in a way that let you access to the ports. Please check this post, which is valid for EC2 and RDS.
In addition to above answers suggesting (1) the modification of the configuration files pg_hba.conf and (2) postgresql.conf and (3) restarting the PostgreSQL service, some Windows computers might also require incoming TCP traffic to be allowed on the port (usually 5432
).
To do this, you would need to open Windows Firewall and add an inbound rule for the port (e.g. 5432).
Head to Control Panel\System and Security\Windows Defender Firewall > Advanced Settings > Actions (right tab) > Inbound Rules > New Ruleā¦ > Port > Specific local ports and type in the port your using, usually 5432 > (defaults settings for the rest and type any name you'd like)
Now, try connecting again from pgAdmin on the client computer. Restarting the service is not required.
After set listen_addresses = '*'
in postgresql.conf
Edit the pg_hba.conf file and add the following entry at the very end of file:
host all all 0.0.0.0/0 md5
host all all ::/0 md5
For finding the config files this link might help you.
Source: Stackoverflow.com