What is SSH tunneling and how do I use it to securely access my database?
SSH tunneling creates an encrypted tunnel through SSH to securely access services that should never be exposed to the public internet — like MySQL running on your Connect Quest VPS. Instead of opening MySQL port 3306 to the internet (major security risk), you connect via SSH and forward the port locally. Set up SSH tunnel: ssh -L 3307:127.0.0.1:3306 root@your-vps-ip -N (forwards local port 3307 to remote MySQL on port 3306). While the tunnel is active, connect your local MySQL client (TablePlus, MySQL Workbench, DBeaver) to 127.0.0.1:3307 — it routes securely through SSH. For permanent tunnels: use autossh (apt install autossh) to keep the tunnel alive automatically. SSH tunneling works for any service: Redis (6379), MongoDB (27017), PostgreSQL (5432), or any internal API. This eliminates the need to expose database ports in UFW firewall rules. All Connect Quest VPS plans include SSH access at connectquest.co.in.