Use SSH to connect to database
So in the past I used
ssh -L 3307:localhost:3306 remote-host
to create a tunnel and connecting to localhost:3307 with intellij. but now i found out theres a ssh tab in the db settings. But it won't work for some reason...
SSH Tab:
Proxy host: remote-host Proxy port: 3307
Proxy user: root Local port: 3306
Auth type: Key Pair
Private key file: ~/.ssh/id_rsa
Passphrase: empty
General tab:
Host: localhost Port: 3307
User: root
Password: empty
After pressing test connection it says:
Connection to datasource failed: SSH: Error connecting to remote host remote-host: Connection timed out: connect.
SSH: Error connecting to remote host remote-host: Connection timed out: connect
I tried googling it but didn't help.
Please sign in to leave a comment.
Could it be some firewall or proxy issue? Is IDE process permitted to connect to remote-host:3307? What OS do you use?
Do you have any proxy configured in the IDE?
I wouldn't know how to see if the IDE is allowed to use 3307, I assume it is, I never told it otherwise. The app is in my allowed list of my windows firewall. I use Windows 10 Pro. I have 0 proxies set in the IDE.
In the General tab you must specify the actual host, port, user name and password of the database machine itself: e.g. an ip/name of the remote database host.
In SSH settings you specify the host, port and credentials of the ssh proxy host: that is the host from where a connection to a remote database host will be made.
Please check https://www.jetbrains.com/help/datagrip/configuring-database-connections.html#connect-to-a-database-with-ssh