I have an issue with MySQL Workbench. This is how my connection looks like:

laptop => bastion:22 => machineX:22 ( => mysql:3306

So, I have two hops before I can reach the database (three hops to the database itself). Only 'machineX' has access to that DB on port 3306.

My SSH config contains:

  ProxyCommand ssh -W %h:%p bastion

Using the above:

  • I can successfully connect to that DB using an ssh tunnel by exposing remote port locally and connecting to localhost
  • I can successfully connect to that DB using Sequel Pro on Mac (using SSH config)

BUT I can't connect using MySQL Workbench (using TCP/IP over SSH option). Even though I specified the ssh config file in MySQL WB properties it seems like it cannot figure out how to make those two hops.

Error message:

Failed to Connect to MySQL at mysql:3306 through SSH tunnel at user@ with user dbuser

11:06:00 [INF][     SSH tunnel]: Existing SSH tunnel not found, opening new one
11:06:00 [INF][     SSH tunnel]: Opening SSH tunnel to
11:06:00 [DB2][sshtunnel.py:do_run:119]: SSH Tunel 17 thread started
11:06:00 [DB2][sshtunnel.py:notify:230]: tunnel_28908: INFO Connecting to SSH server at using key /Users/seb/.ssh/id_rsa...
11:06:00 [DB1][     SSH tunnel]: Waiting on tunnel to connect...
11:06:00 [DB1][sshtunnel.py:wait_connection:484]: INFO: Connecting to SSH server at using key /Users/seb/.ssh/id_rsa...
11:06:10 [DB2][sshtunnel.py:notify:230]: tunnel_28908: IO_ERROR IO Error: timed out.
 Please refer to logs for details.
11:06:10 [DB1][sshtunnel.py:wait_connection:492]: returning from wait_connection(28908): IO Error: timed out.
 Please refer to logs for details.
11:06:10 [DB1][     SSH tunnel]: TunnelManager.wait_connection() returned IO Error: timed out.
 Please refer to logs for details.
11:06:10 [ERR][     SSH tunnel]: TunnelManager.wait_connection got IOError: IO Error: timed out.
 Please refer to logs for details.
11:06:10 [ERR][sshtunnel.py:notify_exception_error:235]: Traceback (most recent call last):
  File "/Applications/MySQLWorkbench.app/Contents/Resources/sshtunnel.py", line 303, in _connect_ssh
    look_for_keys=has_key, allow_agent=has_key, timeout=SSH_CONNECTION_TIMEOUT)
  File "/Applications/MySQLWorkbench.app/Contents/Resources/libraries/paramiko/client.py", line 292, in connect
    retry_on_signal(lambda: sock.connect(addr))
  File "/Applications/MySQLWorkbench.app/Contents/Resources/libraries/paramiko/util.py", line 270, in retry_on_signal
    return function()
  File "/Applications/MySQLWorkbench.app/Contents/Resources/libraries/paramiko/client.py", line 292, in <lambda>
    retry_on_signal(lambda: sock.connect(addr))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 228, in meth
    return getattr(self._sock,name)(*args)
timeout: timed out

Either MySQL Workbench is not smart enough or there's something else that needs to be set up that I'm just not aware of? I tried both MySQL WB for Mac and Windows and no luck. As I said, it works perfectly fine using Sequel Pro for example!

Before you say - establish a tunnel and then connect on localhost - I already say NO, I don't want to do that because of reasons. I want it to work using only the SSH config within the MySQL WB.

  • What you have a hammer all you see is nails. Might it ocurred to you this is not a good setup? Do it properly with a VPN. – Rui F Ribeiro Feb 7 '19 at 11:39
  • What version of Workbench are you using? After months of wondering about using the SSH config with WB, it happened today. My version is 8.0.16. I use named entries, and specified the SSH file Host name for the host in WB. Then filled in the username and key file path to match what's in the SSH config file. Before this the only way I could connect was with a tunnel, and I agree, I don't want to do that. @RuiFRibeiro You have no indication whether he's using a VPN, nor touched the actual question. Some might want to do it properly with additional security layers on top of a VPN – groovenectar May 9 '19 at 20:12
  • You can also try jetbrains.com/datagrip -- Since I finally got WB to connect, I'm going to pass on it. It's really not bad, but lacks a few things that WB can do such as User Management. It'll probably get there eventually, just not there quite yet. However, the JetBrains products seem to work really well with the SSH config file no matter what the config – groovenectar May 9 '19 at 20:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.