Sandbox: How to Connect to Database

This guide provides step-by-step instructions for connecting to MySQL and PostgreSQL via DBeaver using an SSH tunnel.

Prerequisites

  • DBeaver or a similar database management tool installed on your local machine.

  • VPN access to the network where Sandbox is located.

  • SSH private key for authentication.

  • MySQL and PostgreSQL are running inside Docker on Sandbox with ports exposed to the host machine.

Screenshot 2025-03-05 at 17.47.17.png

Connection Process

Step 1: Connect to VPN

Ensure you are connected to the VPN before proceeding. Without the VPN connection, SSH access to Sandbox will not be possible.

Step 2: Prepare Connection Details

  • Linux Address: the address of the Sandbox you want to connect to

  • SSH Private Key Path: path to your private key

Step 3: Configure SSH Tunnel in DBeaver or Similar Tool

  1. Open DBeaver.

  2. Go to Database > New Database Connection.

  3. Select either MySQL or PostgreSQL and click Next.

  4. In the Main tab, enter the following:

    • Host: 127.0.0.1 or localhost

    • Port:

      • for Rocken Jobs MySQL: 3306

      • for CRM PostgreSQL: 5432

    • Database:

      • for Rocken Jobs MySQL: rockenjobs_wordpress

      • for CRM PostgreSQL: talent-ecosystem

    • Username:

      • for Rocken Jobs MySQL: rockenjobs_user_name

      • for CRM PostgreSQL: talent_user_name

    • Password:

      • for Rocken Jobs MySQL: in /home/rockenadmin/rocken/rockenjobs/.env in the Sandbox

      • for CRM PostgreSQL: /home/rockenadmin/rocken/api/.env in the Sandbox

  5. Go to the SSH tab and enable Use SSH Tunnel

  6. Configure SSH tunnel:

    • Host: test.sandbox.rockengroup.com

    • Port: 22

    • User Name: rockenadmin

    • Authentication method: Public Key

    • Private Key: Select your SSH private key file (~/.ssh/id_rsa)

  7. Click Test tunnel configuration to verify connection via SSH.

  8. Click Test Connection to verify connection to the Database.

  9. If all tests passed, go to the Main tab, press Connection details (name, type, …) and type Connection name:

    • for Rocken Jobs MySQL: sandbox-test-rockenjobs_wordpress

    • for CRM PostgreSQL: sandbox-test-talent-ecosystem
      pattern: <env_name>-<host_owner>-<db_name>

  10. Click Finish to save the connection.

Step 4: Verify the Connection

Once connected, the tool should display the database structure. You can now query and manage MySQL and PostgreSQL databases securely via the SSH tunnel.

Troubleshooting

  • Ensure VPN is connected before attempting SSH connection.

  • Verify that MySQL and PostgreSQL containers are running and listening on the expected ports (run docker ps command inside the Sandbox).

Comments

Leave a Reply