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:
ssh -f email@example.com -L 33187:server.domain.com:3306 -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: server.domain.com
- SSH Username: jblow
- SSH Password: password of jblow on server.domain.com
- MySQL Hostname: localhost (or 127.0.0.1, 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.