Database

There are two ways to connect to the database of each environment: PhpMyAdmin or with a database explorer, configured with the remote connection.

PhpMyAdmin

Connecting to PhpMyAdmin is really easy. On the credentials page of each environment, scroll down to the Database section. There is a button that will take you directly to the PhpMyAdmin interface. Make sure you copy the username and password to the clipboard because you will be prompted to enter these details. PhpMyAdmin

Remote connection

When PhpMyAdmin just isn't enough for you, it's always possible to connect your own database explorer to your Hyperlane powered database. There are many tools available these days, some of these are MySQL Workbench, Navicat, Datagrip, ... We will be using DataGrip to document how to setup your connection but the principle will be the same in all database tools.

Warning

You will be connecting with the admin database user who has full access on that database. Be careful when executing delete or update statement when you are not connecting in read-only mode.

SSH Tunnel

For security reasons, the database port will not be made public. So this setup is a little bit more complex. First, make sure the SSH key has been added to your account, and that SFTP is enabled. (regardless of the general Git/SFTP mode). Go to this page if this has not been done yet. Now that the SSH keys have been added, and the SFTP port is open, a tunnel to the MySQL port can be configured.

Command line

To create an SSH tunnel to the MySQL port, copy this command to the clipboard, and execute it in your local shell. The command will have following format:

ssh -L 13306:127.0.0.1:3306 -N [SFTP_USERNAME]@[SFTP_HOSTNAME] -p [SFTP_PORT]

You can now connect to your MySQL instance on port 13306 and host 127.0.0.1.

Continue to Database Connection

Database explorer

When adding a new datasource in our tool, DataGrip, go to the second tab, called SSH/Tunnel. The fields that need to be entered here, can be found in the Credentials tab under SFTP. Here you can find the fields Host, Port and Username. Authentication will always happen with your private key. SFTP Now that all settings are available, enter these in your datasource configuration. Tunnel

Database connection

Now that the tunnel is setup, connect to your database just like you would connect to a database on your local machine. Make sure to use 127.0.0.1 for your host and NOT localhost! Port forwarding will not be available on localhost. The database user and password can be found under the Database section of your credentials. Just like the ones used for PhpMyAdmin.

Warning

When a tunnel was established using the command line method, make sure to connect to the configured local port. (13306 in this case)

Database