Using MySQL Workbench with an SSH Tunnel

From SWCP Support Wiki
Revision as of 17:53, 9 April 2021 by Cheeks (talk | contribs) (Created page with "==MySQL access via SSH Tunnel== MySQL Workbench is a MySQL client program that runs on your Mac/Windows/Linux desktop. It can connect directly to mysql on port 3306. However, ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

MySQL access via SSH Tunnel

MySQL Workbench is a MySQL client program that runs on your Mac/Windows/Linux desktop. It can connect directly to mysql on port 3306. However, the SWCP MySQL servers are firewalled, so customers on other networks can't connect to it directly.

MySQL Workbench and Sequel Pro (Mac only I think) support SSH Tunnels.

NOTE: The user needs shell access enabled for this to work.

Here's how to set it up:

MySQL Workbench

  • Create a new connection profile.
  • Set the Connection Method to "Standard TCP/IP over SSH"
  • Set the SSH hostname to login.swcp.com
  • Set the SSH Username to your shell account login name
  • Set the MySQL Hostname to the hostname for your database. If your database is called "bobwork2", the hostname will be bobwork2.sqldb.swcp.com.
  • Set the Username to your database username (note: not your shell login name)

When you use the profile, you will first get a prompt for the shell account password, and then for the database password. Note that there are two different usernames and passwords in this process.

Sequel Pro

This is another MySQL interface. It's only for the Mac. Get it from http://www.sequelpro.com.

  • In the Connection Details, select the SSH tab
  • Set the MySQL Host to the hostname for your database. If your database is called "bobwork2", the hostname will be bobwork2.sqldb.swcp.com.
  • Enter your database name, username, and password.
  • Set the SSH Host to login.swcp.com
  • Set the SSH User to your shell username. Enter the matching password in the SSH Password field.

Hit the "Test Connection" button to test your settings. If the connection fails, the "Show Details" button will give you some information that you can cut-n-paste and send to help@swcp.com. After you get it working, click "Add to Favorites" to save the settings.

See Also