Connnecting to MySQL through a secure SSH tunnel

If your MySQL database hosting provider supports secure shell (SSH) connections, you can make encypted connections to your remote database by creating an SSH tunnel between your Mac and the server.

Start by launching the Terminal application in the /Applications/Utilities folder. At the prompt, enter:

ssh -C -N -L 3307:

( is the IP address of your web host, and user_name is your login ID that allows you to access the web host system). The 'ssh' command will not return if it is successful.

Using the driver's DSN setup assistant (through the ODBC Administrator), create a DSN with the following information:

Port:  3307

Then enter your User ID and database name as usual.

In this case, the local port 3307 is redirected to the remote port 3306, because you might have a local instance of MySQL already listening on port 3306 of your Mac.  If you don't have a local MySQL, you can go ahead and use 3306 instead of 3307 in the SSH command and the setup assistant.

Now, when you connect to your database through this DSN, all communication will take place using the encrypted SSH tunnel established between port 3307 (or 3306) of your local Mac and port 3306 on the remote server.

If you or your database administrator have any questions or concerns, please contact us at