How to connect PyCharm to postgresql using Vagrant27 Jul 2015
If you want to connect PyCharm to postgresql data source, it is pretty easy to do.
- PyCharm (I think this will also work in other JetBrains products)
- Vagrant box with Postgresql inside it. I assume Vagrant is already configured with PyCharm
- Postgresql jdbc driver installed
Click on a green plus button in a “Database” editor tab. Then choose “PostgreSQL” and enter your settings. If you didn’t change PostgreSQL settings, defaults should be ok.
Don’t forget to enter your database name, username and password. Host should be
127.0.0.1, because we are going to connect through SSH tunnel.
Go to “SSH/SSL” tab and check “Use SSH tunnel” checkbox. Then set proxy host to
127.0.0.1, port to
2222, proxy user to
vagrant and password to
I tried connecting with Vagrant private key (which is usually located in user home folder under
/home/user/vagrant.d/insecure_private_key), but that didn’t work: I only saw “Auth fail” message
Now you are ready to press “Test connection” button on a “Database” tab. You should see a message telling that connection is successfull: