- Add a port forwarding entry to your Vagrantfile:
config.vm.network "forwarded_port", guest: 5432, host: 15432
. I'm using Vagrant 1.6.3 here. Start/restart your Vagrant image. -
Edit the pg_hba.conf file on the vagrant image. This file may reside in different areas; ours was in /etc/postgresql/9.1/main/. Change the IPv4 local connections entry from...
host all all 127.0.0.1/32 trust
tohost all all 0.0.0.0/0 trust
- Restart PostgreSQL on the vagrant image:
sudo service postgresql restart
- Configure your database tool to connect to localhost, port 15432.
Tuesday, September 02, 2014
Exposing PostgreSQL on vagrant to host OS
I've been working with vagrant lately on a Ruby project and I wanted to the ability to view the PostgreSQL database on the vagrant image through DbVisualizer on my OS X system. This is quite easy to set up in PostgreSQL and vagrant.
Subscribe to:
Posts (Atom)