How do I connect to a MySQL database on Spinup?

This guide outlines the steps required to securely connect to a MySQL database in Spinup Spaces.

  1. Setting Up the Firewall:
    Ensure that port 3306 is open on your Space Firewall. For guidance, see How to Configure the Firewall in Spinup Spaces.

  2. Choosing a MySQL Client:
    There are various clients available to connect to a MySQL database. For a comprehensive list, click here. For initial connection testing, we recommend using the official mysql client via the command line.

  3. Establishing the Connection:
    On a machine with the mysql client installed, execute the following command:

mysql -u [USERNAME] -p -h [DATABASEURL]

Example:

mysql -u db01 -p -h spinup-mysql-01.c9ukc6s0rmbg.us-east-1.rds.amazonaws.com

After logging in, choose your desired database with the use command:

use db01

Always ensure you connect to the database with SSL encryption. While the mysql client enables SSL by default, some application connections may need manual setup.


Connecting to Secure Spinup Spaces via SSH Tunneling

For Spinup spaces that hold moderate or high-risk data with limited port access, you might not be able to directly connect from external devices like laptops. An SSH tunnel can help:

1. Establish the SSH Tunnel:

2. Connect Using the Tunnel:
Open a new terminal and use the following command to connect through the established tunnel:

This command connects to the database instance at spinup-db000b68.cluster-cyynsscieqtk.us-east-1.rds.amazonaws.com via the server spinup-000b65.spinup.yale.edu, using the local port 3307.