Cannot establish tunnel to MySQL
See original GitHub issueWhen trying to connect to SSH Tunnel with JSch I get this error:
Cannot establish tunnel
Auth fail
Auth fail
The debug log says:
2018-08-02 22:06:50.857 - Connect with 'xxx.yyy' (mysql5-163d6635589-2983690c749436c8)
2018-08-02 22:06:50.857 - Instantiate SSH tunnel
2018-08-02 22:06:50.857 - Connect to tunnel host
2018-08-02 22:06:50.873 - SSH INFO: Connecting to xxx.yyy port 22
2018-08-02 22:06:50.919 - SSH INFO: Connection established
2018-08-02 22:06:50.966 - SSH INFO: Remote version string: SSH-2.0-OpenSSH
2018-08-02 22:06:50.966 - SSH INFO: Local version string: SSH-2.0-JSCH-0.1.54
2018-08-02 22:06:50.966 - SSH INFO: CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
2018-08-02 22:06:50.982 - SSH INFO: CheckKexes: diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
2018-08-02 22:06:51.123 - SSH INFO: CheckSignatures: ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
2018-08-02 22:06:51.123 - SSH INFO: SSH_MSG_KEXINIT sent
2018-08-02 22:06:51.123 - SSH INFO: SSH_MSG_KEXINIT received
2018-08-02 22:06:51.123 - SSH INFO: kex: server: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
2018-08-02 22:06:51.138 - SSH INFO: kex: server: ssh-dss,ssh-rsa,ssh-dss
2018-08-02 22:06:51.138 - SSH INFO: kex: server: aes128-ctr,aes192-ctr,aes256-ctr
2018-08-02 22:06:51.138 - SSH INFO: kex: server: aes128-ctr,aes192-ctr,aes256-ctr
2018-08-02 22:06:51.138 - SSH INFO: kex: server: hmac-sha1,hmac-ripemd160
2018-08-02 22:06:51.138 - SSH INFO: kex: server: hmac-sha1,hmac-ripemd160
2018-08-02 22:06:51.138 - SSH INFO: kex: server: none,zlib@openssh.com
2018-08-02 22:06:51.138 - SSH INFO: kex: server: none,zlib@openssh.com
2018-08-02 22:06:51.154 - SSH INFO: kex: server:
2018-08-02 22:06:51.154 - SSH INFO: kex: server:
2018-08-02 22:06:51.154 - SSH INFO: kex: client: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
2018-08-02 22:06:51.154 - SSH INFO: kex: client: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
2018-08-02 22:06:51.169 - SSH INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc
2018-08-02 22:06:51.169 - SSH INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc
2018-08-02 22:06:51.169 - SSH INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
2018-08-02 22:06:51.169 - SSH INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
2018-08-02 22:06:51.185 - SSH INFO: kex: client: none
2018-08-02 22:06:51.185 - SSH INFO: kex: client: none
2018-08-02 22:06:51.185 - SSH INFO: kex: client:
2018-08-02 22:06:51.185 - SSH INFO: kex: client:
2018-08-02 22:06:51.185 - SSH INFO: kex: server->client aes128-ctr hmac-sha1 none
2018-08-02 22:06:51.185 - SSH INFO: kex: client->server aes128-ctr hmac-sha1 none
2018-08-02 22:06:51.201 - SSH INFO: SSH_MSG_KEX_ECDH_INIT sent
2018-08-02 22:06:51.201 - SSH INFO: expecting SSH_MSG_KEX_ECDH_REPLY
2018-08-02 22:06:51.248 - SSH INFO: ssh_rsa_verify: signature true
2018-08-02 22:06:51.248 - SSH INFO: Host 'xxx.yyy' is known and matches the RSA host key
2018-08-02 22:06:51.248 - SSH INFO: SSH_MSG_NEWKEYS sent
2018-08-02 22:06:51.248 - SSH INFO: SSH_MSG_NEWKEYS received
2018-08-02 22:06:51.248 - SSH INFO: SSH_MSG_SERVICE_REQUEST sent
2018-08-02 22:06:51.279 - SSH INFO: SSH_MSG_SERVICE_ACCEPT received
2018-08-02 22:06:51.326 - SSH INFO: Disconnecting from xxx.yyy port 22
2018-08-02 22:06:51.326 - Connection failed (mysql5-163d6635589-2983690c749436c8)
2018-08-02 22:06:51.404 - org.jkiss.dbeaver.model.exec.DBCException: Can't initialize tunnel
org.jkiss.dbeaver.model.exec.DBCException: Can't initialize tunnel
at org.jkiss.dbeaver.registry.DataSourceDescriptor.connect(DataSourceDescriptor.java:733)
at org.jkiss.dbeaver.runtime.jobs.ConnectJob.run(ConnectJob.java:70)
at org.jkiss.dbeaver.runtime.jobs.ConnectJob.runSync(ConnectJob.java:98)
at org.jkiss.dbeaver.ui.actions.datasource.DataSourceHandler.connectToDataSource(DataSourceHandler.java:106)
at org.jkiss.dbeaver.registry.DataSourceDescriptor.initConnection(DataSourceDescriptor.java:657)
at org.jkiss.dbeaver.model.navigator.DBNDataSource.initializeNode(DBNDataSource.java:147)
at org.jkiss.dbeaver.model.navigator.DBNDatabaseNode.getChildren(DBNDatabaseNode.java:195)
at org.jkiss.dbeaver.model.navigator.DBNDatabaseNode.getChildren(DBNDatabaseNode.java:1)
at org.jkiss.dbeaver.ui.navigator.NavigatorUtils.getNodeChildrenFiltered(NavigatorUtils.java:564)
at org.jkiss.dbeaver.ui.navigator.database.load.TreeLoadService.evaluate(TreeLoadService.java:49)
at org.jkiss.dbeaver.ui.navigator.database.load.TreeLoadService.evaluate(TreeLoadService.java:1)
at org.jkiss.dbeaver.ui.LoadingJob.run(LoadingJob.java:86)
at org.jkiss.dbeaver.ui.LoadingJob.run(LoadingJob.java:71)
at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:95)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:60)
Caused by: org.jkiss.dbeaver.DBException: Cannot establish tunnel
at org.jkiss.dbeaver.model.net.ssh.SSHImplementationJsch.setupTunnel(SSHImplementationJsch.java:77)
at org.jkiss.dbeaver.model.net.ssh.SSHImplementationAbstract.initTunnel(SSHImplementationAbstract.java:125)
at org.jkiss.dbeaver.model.net.ssh.SSHTunnelImpl.initializeTunnel(SSHTunnelImpl.java:70)
at org.jkiss.dbeaver.registry.DataSourceDescriptor.connect(DataSourceDescriptor.java:731)
... 14 more
Caused by: com.jcraft.jsch.JSchException: Auth fail
at com.jcraft.jsch.Session.connect(Session.java:519)
at org.jkiss.dbeaver.model.net.ssh.SSHImplementationJsch.setupTunnel(SSHImplementationJsch.java:69)
... 17 more
I’m trying to connect with a password and I’m sure the credentials are OK. I can connect fine with Putty or with HeidiSQL (but the latter uses Putty for SSH so it’s the same). I’m on Windows. Can you figure out from the log what may be wrong? I tried to use the SSHJ plugin but the installation fails with an error every time.
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Trying to use MySQL Workbench with TCP/IP over SSH
As another test - I set up a SSH tunnel with port 3306 using Putty and I can connect OK using MySQL Workbench...
Read more >mysql could not connect the SSH tunnel -> access denied for ...
Scenario two: I try to access the MySQL database using an OpenSSH generated private key. I set the location of the key to...
Read more >MySQL cannot connect via SSH tunnel -- Connection refused
Run command mysql -p -u db_user -P 10006 -h 127.0.0.1 database_name on workstation to connect to MySql server. You can connect to PhpMyAdmin...
Read more >How to Create an SSH Tunnel for a MySQL Database - Nexcess
Creating an SSH Tunnel for Your Site's MySQL Database · Open the MySQL Workbench client and click the Plus Icon to the right...
Read more >How to Connect to MySQL through SSH Tunnel - Linuxize
Create an SSH Tunnel on Windows # · Launch Putty and enter the IP Address of the server in the Host name (or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Seems to be the same issue as #298 and #3284 Could you try SSHJ instead of JSch (Help->Install New Software->https://dbeaver.io/update/sshj/latest/)?
Thank you, it’s great you figured this out!
My bad, I actually missed that part because I forgot that our providers indeed has a dedicated internal host name for database connections instead of localhost so I should have known better. The SSH host name works as well just as you found out.
Therefore, SSHJ already works for me, if JSch will be fixed then that’s great, too.