3

I'm developing a Django project in Pycharm 4.5.3, and I can't seem to connect to my Postgres DB on the vagrant instance for the project. Pycharm is able to successfully connect to the box to run the remote interpreter for the project, and I can vagrant ssh just fine, but every time I try to add the Postgres data source under the 'Databases' tab I get the following error:

Connection to PostgreSQL - dbname@localhost failed: SSH: Auth fail

I'm using the following settings:

Database Tab:
    Host: localhost
    Port: 5432
    Database: dbname
    User: vagrant
    Password: <blank> (no password for this DB user)
    URL (autofilled): jdbc:postgresql://localhost:5432/dbname

SSH/SSL Tab:
    Proxy host: localhost
    Port: 2222
    Proxy User: vagrant

Interestingly enough, when I try to use password auth in the SSH/SSL tab with the default password 'vagrant', I get a popup that tells me the password is incorrect, which I know to not be true. Anyone know what the issue might be?

Games Brainiac
  • 80,178
  • 33
  • 141
  • 199
xjtian
  • 966
  • 1
  • 7
  • 15

1 Answers1

7

You got almost everything right. The issue is that you are not able to login to the VM via ssh due to authentication failure as the error message states. I only managed to connect changing the auth method.

In order to do so, you must select Key pair authentication type and use vagrant's private key, which is located in <vagrant root>/.vagrant/machines/default/virtualbox/private_key.

This is what my dialog looks like (I replaced my actual path with <my vagrant root>) :

enter image description here

The key at ~/.vagrant.d/insecure_private_key won't work.

This answer helped me to connect with Pycharm, even though the author print screen displays a password based authentication.

Community
  • 1
  • 1
alfetopito
  • 1,453
  • 2
  • 18
  • 27