Acces PostgreSQL via pgAdmin on the host machine.

Hi,

I am trying to access the PostgreSQL server installed on the VM from pgAdmin III on my host machine. I tried to add a forward_port on the Vagrantfile but it does not work... config.vm.forward_port 5432, 5432

Any idea?

Thanks.

Sorry You must be a logged in, registered user to answer a question.

Answers

Ok I actually found it.

  • Add a forward_port in Vagrantfile, for example: config.vm.forward_port 5432, 15432

  • Enable remote access of the PostgreSQL server sudo vim /etc/postgresql/9.1/main/postgresql.conf change listen_addresses = 'localhost' to listen_addresses = '*'

It should then work from pgAdmin on the host machine.

Actually, Chef overrides the second change when I start the VM again. So you have to change the postgresql cookbook: cookbooks/postgresql/attributes/default.rb change ['listen_addresses'] = 'localhost' to ['listen_addresses'] = '*'
Michael on