:::: MENU ::::

SSH Tunnel for Tableau on a Mac

I use Tableau to explore my data, and usually my data is stored in MySQL on a database server that allows only local connections. Therefore, I need to use SSH tunneling to connect to my data. Tableau doesn’t support tunneling natively, but Macs are equipped with OpenSSH by default and make tunneling easy.

My database server allows only local connections through MySQL’s standard port using the port and bind-address settings for MySQL. Here’s the relevant part of my.cnf:
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1

To use an SSH tunnel and Tableau to connect to a MySQL server:

    1. Open iTerm (or Terminal)
    2. ssh -NC user@host -L 9999:127.0.0.1:3306
    3. Open Tableau
    4. Choose “Connect to data” from the Tableau start screen Tableau Start Screen
    5. Choose “MySQL” from the Connect listTableau Connect Options
    6. Enter 127.0.0.1 and port 9999 into Tableau’s MySQL login window. Don’t forget to include your database username and password. Click “Connect”!Tableau MySQL Login
    7. When you’re done with Tableau, you can kill the tunnel with a Ctrl+C in iTerm.

Troubleshooting

Make sure you have MySQL’s ODBC driver installed first, or no amount of tunneling will help you.

Use “127.0.0.1” as the server, not “localhost”.


So, what do you think ?

You must be logged in to post a comment.