Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to access a mysql server via an SSH tunnel. My understanding is that this should be supported natively in Mysql Workbench (5.2.35 on Ubuntu 10). The following works:

Open shell

ssh -f -L -N

Open MySql Workbench

connect to localhost using port 33187 using connection method "Standard TCP/IP"

The following does not work:

kill any ssh port forwarding to start with a clean slate.

Open Mysql Workbench

Choose connection method "Standard TCP/IP over SSH"

Enter the following connection variables (which appear to align with previously working ssh command:

  • SSH Hostname:
  • SSH Username: jblow
  • SSH Password: password of jblow on
  • MySQL Hostname: localhost (or, tried it both ways)
  • MySQL Server Port: 33187

Ultimate goal is to provide a workbench configuration file which contains the proper setup (minus passwords) for many servers which users (devs) can simply place on their machines and be able to easily access appropriate DB's via existing connections listed in front page of mysql workbench. Worst case scenario I can give them a bash script to put in their .bashrc plus the workbench config file... but I'd prefer one file if I can, especially because I have users on Windows so if I can use a workbench config file, then it will be essentially the same procedure for windows users and for linux users.

NOTE: The goal is to have mysql workbench map from 3306 which is the port on the remote server to some other port locally (as happens in the example ssh command). putting 3306 as the MySQL Server Port causes an error because 3306 is not available on my local machine (because it is running a local mysql instance). After looking at this further, it appears this is not possible. If I kill the local mysql server instance (freeing port 3306) then mysql workbench can connect using 3306 as the mysql server port (which is the correct port on the remote machine), but there does not appear to be a way to support both a local mysql instance and a remote connection via ssh solely through mysql workbench as it gets port conflicts. Using port mapping requires either some iptables entries or doing the ssh tunneling separately from the mysql workbench configuration I think.

share|improve this question

You're doing your ssh forwarding backwards, i.e. you're forwarding local port 3306 to 33187, use -R For the workbench use MySQL Server Port 3306 and MySQL Hostname: localhost

What specifically is the error you're getting, I'm having a problem myself using a custom ssh port, i.e. SSH Hostname the workbench for whatever reason doesn't actually attempt a connection (verified by watching the logs)

share|improve this answer
MySQL Hostname: localhost (or, tried it both ways)
MySQL Server Port: 33187

Change it to:

MySQL Hostname:
MySQL Server Port: 3306

and try again.

share|improve this answer
That would fail (and did when attempted), since 3306 on my local machine is not an available port (since it has my local mysql server instance running on it). I will edit my question appropriately. – Robert Oct 31 '11 at 18:58
updated my answer. – quanta Nov 1 '11 at 0:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.