Darren O'Neill

Connecting to a Vagrant database using 0xDBE

0xDBE is a new SQL editor from Jetbrains that is currently available as an Early Access Program (EAP). As a user of PyCharm I thought I would check it out.

It seems a solid program but it can be a bit fiddly getting connected to a database in a Vagrant virtual machine. You have to make sure you are using the correct private key for the vagrant user. Below are some instructions for Mac users to connect to a PostgreSQL database. The SSH/SSL settings should be the same for MySQL etc.:

  1. Make sure you have the PostgreSQL driver installed
  2. Create a new PostgreSQL data source and under the "Database" tab fill in the database name and access credentials. You can leave the default host (localhost) and port (5432).
  3. Under the SSH/SSL tab check the "Use SSH tunnel" box and set:
    Proxy host:  127.0.0.1
    Port:        2222
    Proxy user:  vagrant
    Auth type:   Key pair (OpenSSH)
    Private key: /Users/username/.vagrant.d/insecure_private_key
    

Replace username with your Mac username.

That should be it!