There was a problem loading the comments.

Connect to MySQL remotely on shared hosting (SSH tunnel) — GARMTECH

Support Portal  »  Knowledgebase  »  Viewing Article

  Print

On shared hosting, databases are designed to be accessed by websites running on the same server. For security reasons, direct access to MySQL from the Internet (port 3306) is typically restricted.

If you need to work with your database from your computer, use one of the safe options below.

Option A (simple): use phpMyAdmin in Plesk

  1. Log in to Plesk via My.GARMTECH.
  2. Open Websites & DomainsDatabases.
  3. Click phpMyAdmin next to your database.

This is the easiest way for imports/exports, editing tables, running queries, etc.

Option B: connect via SSH tunnel (recommended for DB tools)

An SSH tunnel lets your database client connect to 127.0.0.1 on your computer, while the traffic is securely forwarded to the database on the hosting server.

Prerequisites

  • SSH access must be enabled for your hosting subscription.
  • You need your hosting server hostname (shown in My.GARMTECH / service details).
  • You need a valid SSH username/password (or SSH key, if configured).

macOS / Linux

Open Terminal and run (replace placeholders):

ssh -L 3307:localhost:3306 USERNAME@SERVER_HOSTNAME -p 22

Then connect your DB client to:

  • Host: 127.0.0.1
  • Port: 3307
  • User / Password: your database user credentials
  • Database: your database name

Why port 3307? It avoids conflicts if your computer already runs MySQL on port 3306.

Windows (PuTTY)

  1. Open PuTTY → ConnectionSSHTunnels.
  2. Source port: 3307
  3. Destination: localhost:3306
  4. Click Add.
  5. Connect to your server hostname and log in via SSH.

In your DB tool, connect to 127.0.0.1:3307.

Option C: use a VPS (when you need direct DB access from an app/server)

If you need an application outside the hosting server to connect to MySQL directly (for example, from an external server), shared hosting may not be suitable. Consider hosting the application and database on a VPS.

Security notes

  • Do not expose database credentials publicly.
  • Close the SSH session when you finish working (it closes the tunnel).

Share via
Did you find this article useful?  

Related Articles


Comments

Add Comment

Replying to  

Tags

© GARMTECH