Guide

Connect to a private database from your phone with an SSH tunnel

Updated 2026-11-23

Production databases usually are not exposed to the internet. They live in a private network and are reachable only from a bastion (jump) host. On a laptop you would run ssh -L; on Android TivaroSQL Studio does the same thing for you.

What you need

  • An SSH host that can reach the database (e.g. bastion.example.com).
  • An SSH user with a password or a private key (OpenSSH, PKCS#8 or PuTTY .ppk).
  • Database host and port as seen from the bastion – often a private address such as 10.0.3.12:5432.
  • TivaroSQL Studio Pro (the SSH tunnel is a Pro feature).

Step by step

  1. Create a new connection for your engine (PostgreSQL, MySQL, SQL Server, Oracle or ClickHouse).
  2. Enter the database host and port exactly as the bastion sees them.
  3. Open the SSH tunnel section and enter the SSH host, port 22, user and password or key.
  4. Tap Test. On the first connection the app shows the server's key fingerprint – compare it with your server and accept. Later connections verify the key automatically (trust on first use).
  5. Tag the connection PROD and consider read-only mode for on-call work.

Security tips

  • Use a dedicated SSH key for the phone and remove it from authorized_keys if the phone is lost.
  • Use a database user with minimal privileges; for checks, a read-only role is enough.
  • Enable the app lock (fingerprint or PIN) for production connections.
  • Secrets are encrypted with Android Keystore and never leave the device.
TivaroSQL Studio on Android

Frequently asked questions

Is an SSH tunnel safer than opening the database port?

Yes. The database stays private; only SSH is exposed and it can be limited to keys and specific users.

Why does TLS to ClickHouse fail through the tunnel?

Through a tunnel the app connects to 127.0.0.1, so the certificate host name does not match. Use the tunnel without HTTPS or connect directly.