SSH Tunnel Creation failed: open failed

When attempting to connect to a remote mysql server through an ssh tunnel, I receive "SSH Tunnel Creation failed: open failed".

Although the following works through the command line: 

ssh username@mysqlServer -L 22:remoteHost:3306
2022-04-18 14:58:14,313 [  57564]   INFO - n.s.s.t.r.JCERandom - Creating new SecureRandom.
2022-04-18 14:58:14,411 [  57662]   INFO - #c.i.s.i.s.sshj - Client identity string: SSH-2.0-IntelliJ__DataGrip_DB-221.5080.224__SSHJ_0.32.0_idea2
2022-04-18 14:58:14,508 [  57759]   INFO - #c.i.s.i.s.sshj - Server identity string: SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.8
2022-04-18 14:58:15,258 [  58509]   INFO - #c.i.s.i.s.sshj - Authentication log: SSH connection to username@mysqlServer:22
 * With altered connection settings:
  - authMethods: PublicKey(privateKeys=[C:\Users\spenc\.ssh\id_rsa, C:\Users\spenc\.ssh\id_dsa, C:\Users\spenc\.ssh\id_ecdsa, C:\Users\spenc\.ssh\id_ed25519, C:\Users\spenc\.ssh\id_xmss], agent=NO), Password, KeyboardInteractive
  - user: username
 * Connected: Socket[addr=mysqlServer/mysqlServer,port=22,localport=63766]
 * Starting authentication
  => none (failure, new auth methods allowed by the server: publickey)
  => publickey C:\Users\spenc\.ssh\id_rsa (success)
2022-04-18 14:58:15,270 [  58521]   INFO - #c.i.d.d.DatabaseSshTunnelEstablisher - SSH tunnel created: 63768:remoteHost:3306
2022-04-18 14:58:15,317 [  58568]   INFO - #c.i.e.r.RemoteProcessSupport - "C:\Program Files\JetBrains\DataGrip 2022.1.1\jbr\bin\java" -Djava.rmi.server.hostname=127.0.0.1 -Duser.timezone=UTC -Xmx750m -Xms128m -Dfile.encoding=UTF-8 -classpath "C:\Program Files\JetBrains\DataGrip 2022.1.1\lib\util_rt.jar;C:\Program Files\JetBrains\DataGrip 2022.1.1\lib\util.jar;C:\Program Files\JetBrains\DataGrip 2022.1.1\lib\groovy.jar;C:\Program Files\JetBrains\DataGrip 2022.1.1\plugins\DatabaseTools\lib\jdbc-console.jar;C:\Users\spenc\AppData\Roaming\JetBrains\DataGrip2022.1\jdbc-drivers\MySQL ConnectorJ\8.0.25\mysql-connector-java-8.0.25.jar" com.intellij.database.remote.RemoteJdbcServer com.mysql.cj.jdbc.Driver
2022-04-18 14:58:15,705 [  58956]   INFO - #c.i.e.r.RemoteProcessSupport - Port/ServicesPort/ID: 58696/63770/RemoteDriverImpld6de775c
2022-04-18 14:58:15,713 [  58964]   INFO - #c.i.e.r.RemoteProcessSupport - 
2022-04-18 14:58:15,772 [  59023]   INFO - #c.i.d.d.DatabaseConnectionEstablisher - Connecting to: jdbc:mysql://remoteHost:3306/dbName
2022-04-18 14:58:15,774 [  59025]   INFO - #c.i.d.d.DatabaseConnectionEstablisher - Auth provider: user-pass
2022-04-18 14:58:15,776 [  59027]   INFO - #c.i.d.d.DatabaseCredentialsAuthProvider - Connecting as: username
2022-04-18 14:58:15,778 [  59029]   INFO - #c.i.d.d.DatabaseConnectionEstablisher - Connecting to (rewritten): jdbc:mysql://localhost:63768/dbName
2022-04-18 14:58:15,987 [  59238]   WARN - #c.i.s.i.s.sshj - <<chan#0 / open>> woke to: Opening `direct-tcpip` channel failed: open failed
2022-04-18 14:58:15,989 [  59240]   INFO - #c.i.s.i.s.sshj - Error in `SSHJ local tunnel for SshjSshConnection(username@mysqlServer)@82260ee: Local client /127.0.0.1:63774 ==> Local server localhost:63768 ==> Remote server remoteHost:3306`: net.schmizz.sshj.connection.channel.OpenFailException: open failed
2022-04-18 14:58:16,016 [  59267]   WARN - #c.i.d.d.BaseDatabaseErrorHandler$IOErrorInfo - Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
    at com.mysql.cj.protocol.FullReadInputStream.readFully(FullReadInputStream.java:67)
    at com.mysql.cj.protocol.a.SimplePacketReader.readHeader(SimplePacketReader.java:63)
    at com.mysql.cj.protocol.a.SimplePacketReader.readHeader(SimplePacketReader.java:45)
    at com.mysql.cj.protocol.a.NativeProtocol.readMessage(NativeProtocol.java:540)
    at com.mysql.cj.protocol.a.NativeProtocol.readServerCapabilities(NativeProtocol.java:498)
    at com.mysql.cj.protocol.a.NativeProtocol.beforeHandshake(NativeProtocol.java:385)
    at com.mysql.cj.protocol.a.NativeProtocol.connect(NativeProtocol.java:1351)
    at com.mysql.cj.NativeSession.connect(NativeSession.java:157)
    at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:953)
    at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:823)
    at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:453)
    at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246)
    at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198)
    at com.intellij.database.remote.jdbc.helpers.JdbcHelperImpl.connect(JdbcHelperImpl.java:639)
    at com.intellij.database.remote.jdbc.helpers.MysqlBaseJdbcHelper.connect(MysqlBaseJdbcHelper.java:244)
    at com.intellij.database.remote.jdbc.impl.RemoteDriverImpl.connect(RemoteDriverImpl.java:55)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
    at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
    at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)
    Suppressed: com.intellij.database.util.AsyncTask$Frame$FrameData: Async frame data: Test Connection -> Prepare connection -> Establish database connection -> Get database credentials -> Perform database connection
2022-04-18 14:58:16,019 [  59270]   INFO - #c.i.e.r.RemoteProcessSupport - Terminating: 127.0.0.1:58696/RemoteDriverImpld6de775c
2022-04-18 14:58:16,054 [  59305]   INFO - #c.i.e.r.RemoteProcessSupport - Process finished with exit code -1
1 comment
Comment actions Permalink

This isn't a solution and I'm not knocking DataGrip at all, but I tried "MySQL Workbench" for Windows, and it worked without a hitch. Still don't know what the problem is. I also tried DBeaver and TablePlus, and both of those did not work either. 

0

Please sign in to leave a comment.