# How to Connect to MySQL Remotely (SSH Tunnel)

> Canonical: https://jethost.com/kb/how-to-connect-to-mysql-remotely-ssh-tunnel/ · Last modified: 2026-10-21T16:53:06+00:00

Need to connect to your JetHost database from a desktop tool like HeidiSQL or MySQL Workbench? Direct remote MySQL connections are blocked at the firewall for security – even if you whitelist your IP. The safe, supported way to connect is through an **SSH tunnel**, available on every [JetHost web hosting plan](https://jethost.com/web-hosting/). This guide shows how.

## Why an SSH tunnel, not direct access

For security, our firewall blocks direct MySQL connections from outside the server. Adding your IP under **Remote Database Access** in cPanel still won’t let an external client connect directly, so you’ll see a connection timeout or “can’t connect” error. An SSH tunnel solves this neatly: your database tool connects over SSH – which *is* open – and the connection is routed securely to MySQL on the server. It’s both the working method and the more secure one, because nothing is exposed to the open internet.

## What you’ll need

- Your **database username and password** (from cPanel → [Manage My Databases](https://jethost.com/kb/creating-a-mysql-database-and-user-in-cpanel/)).
- Your **cPanel username and password**, used for the SSH login.
- Your server’s hostname or IP, and the SSH port – **1022** on JetHost.

## Connect with an SSH tunnel in HeidiSQL

HeidiSQL supports SSH tunnels out of the box. Open it, click **New** to create a session, and on the **Settings** tab enter:

- **Network type**: MySQL (SSH tunnel)
- **Hostname / IP**: `127.0.0.1`
- **User**: your database username
- **Password**: your database user’s password
- **Port**: `3306`

Then switch to the **SSH tunnel** tab and fill in:

- **plink.exe location**: point to your local `plink.exe` (HeidiSQL usually includes it; otherwise download it from the PuTTY website)
- **SSH host + port**: your server’s hostname or IP, port `1022`
- **Username**: your cPanel username
- **Password**: your cPanel password (or a private key, if you’ve set up [SSH keys](https://jethost.com/kb/generate-ssh-key-cpanel/))
- **Local port**: `3307` (or any free local port)

Click **Open**. HeidiSQL routes the database connection securely through SSH, and you can manage your databases as usual. Other tools such as MySQL Workbench and DBeaver offer the same SSH tunnel option – use the same values in their equivalent fields.

## JetHost Experts Tip

The two most common mistakes: setting the hostname to the server instead of `127.0.0.1`, and using the standard SSH port 22 instead of JetHost’s `1022`. The database host must stay `127.0.0.1` – from the server’s point of view, the tunnel makes the connection look local.

**Related:** [Find MySQL database details](https://jethost.com/kb/how-to-find-your-mysql-database-details-on-cpanel/), [Manage MySQL user privileges](https://jethost.com/kb/how-to-manage-mysql-user-privileges/).

## Need more help?

Tunnel still not connecting? Open a ticket through **Client Area → Support Tickets** with the tool you’re using and the exact error, and our team will help you get connected.
