How can I access Postgresql hosted in Vagrant as a guest in Windows? How can I access Postgresql hosted in Vagrant as a guest in Windows? postgresql postgresql

How can I access Postgresql hosted in Vagrant as a guest in Windows?


I dont know what you mean with in pg_hba.conf but in vagrant enviroment you should use ip like 10.0.2.2/24 instead your machine network address.


In your Vagrant config add a IP (if not set) eg:

config.vm.network :forwarded_port, host: 15432, guest: 5432config.vm.network :private_network, ip: "192.168.111.222"

Now from PGAdmin in Windows connect to host 192.168.111.222, port 5432.

Worked for me although I'm not know why.. :P


I had the same problem in linux, and i think in windows this can happen too. In my postgresql.conf the port variable was defined in two places. First with 5432 value, and second with 5435 value.

Running telnet vm_ip 5435, i was able to connect to the server running in the vm.

In my case my vm was running with public_network option, so i have a external ip. In this case, you don't need to forward a port, once you will access the vm,for example, with 192.168.60.15:5435 address.