Skip to main content

Connect to the Database

Matt Gray avatar
Written by Matt Gray
Updated over 2 weeks ago

Connecting directly to the database is often useful to get an idea of what data is stored and processes are running. You may want to quickly check out a bit of data, do a bit of debugging, or get to the bottom of some slow queries.

Note: If you're looking to import data, we'd recommend taking a look at the Import Database documentation.

Connecting Via SSH Tunnelling

Connections to the database are established via SSH Tunnels. This ensures that your database is never exposed to the public internet and you can strictly control who has access.

  1. Go to your project's Access Control page.

  2. In the 'SSH Connection' section, select an environment and check the 'Include database port forward' option.

  3. Copy the supplied SSH Connection string into a terminal on your local machine.

    Run it to open an SSH connection with an included port forward for the database.

  4. You can now use the details supplied in the 'Database Connection' section to connect directly to the database running on Servd.

    The 'Full URL' can be copied and pasted into tools that accept a full connection URL to establish a connection, such as TablePlus.

    'MySQL CLI' can be copied directly into a second terminal running on your local machine to connect using the command line MySQL client.

    Otherwise, you can use the other supplied values to set up a connection in your favourite SQL client application.

Using A Database Client

To connect to the database you will need a MySQL client, such as the mysql's CLI tool, TablePlus or SequelAce. Each tool requires slightly different steps to configure, however the details needed will be the same for each.

Did this answer your question?