How to Connect to Vagrant DB

  • 3
  • 27

I have successfully setup a working PyCharm/Vagrant/Django environment on Mac OSX. However, I've got stuck on how best to connect to the Postgresql database on the Vagrant machine for my Django project.

Obviously it needs to be done through the SSH Tunnel setting in the Remote Database options, but I can't get the various port/host configurations to work correctly.

Would love some pointers!
Question is not answered.
Has been 1 times resubmitted ( last: 10/15/13 )
Currently the configuration UI is not user-friendly so we are going to improve it soon.

Here's the settings chain:

Suppose the original MySQL URL is jdbc:mysql://real-db-host:3305/db-name
and we want to setup SSH tunnel in the middle. The configuration is changed as follows (see screenshot):

1. SSH Tunnel dialog
SSH tunnel is created on localhost:537 to ssh-server:22 (authentication applied)
which in its turn will pass packets to real-db-host:3305

2. Datasource Properties dialog:
the original JDBC url has to be changed to jdbc:mysql://localhost:537/db-name



Screen Shot 2013-10-17 at 21.08.28 .png

Thanks Gregory for your help. That config worked for me!