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.
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 to establish the connection will be the same for each.
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.
Go to your project's Access Control page.
Create a new SSH Session. You can read more about SSH Sessions here
Expand the 'Tunnelling Info' section of the SSH Sessions Panel
Connect to your SSH Session from a terminal on your local machine or via an SSH GUI program such as PuTTY.
When establishing the connection, add a local port tunnel.
The source port can be any free port on your local machine, something like 9876 should work.
The remote host can be found in the Tunnelling Info section of the SSH Session Panel.
β
The remote port can be found in the Tunnelling Info section of the SSH Session Panel.You can now use your mysql client to connect to the database.
Specify the host as '127.0.0.1'
Specify the port as the local port you set for your tunnel
Use the username, password and database values from the Tunnelling Info section of the SSH Sessions panel in our dashboard.