Connecting to MySQL from an External Host (Firstserv Guide)

This guide explains how to connect to your Firstserv MySQL database from an external location, such as:

  • βœ… Your home or office computer
  • βœ… A remote server
  • βœ… A development environment

How MySQL Access Works

  • Your MySQL server runs on:
    Port 3306
    
  • When connecting from your website (on the same server), you use:
    localhost
    

πŸ‘‰ To connect externally, you must first authorise your IP address in cPanel.


Before You Start

You will need:

  • βœ… Your external IP address
  • βœ… Your database name, username, and password
  • βœ… Access to your cPanel account

Find Your IP Address

  • Visit a site like:
    https://viewmyip.co.uk
    
  • Or ask your network/server provider

Allow External Access in cPanel


Step 1: Open Remote MySQL

  1. Log in to cPanel
  2. Navigate to:
    Databases β†’ Remote MySQL
    

Step 2: Add Your IP Address

  1. Enter your IP address in:
    Add Access Host
    
  2. (Optional) Add a comment (e.g. β€œOffice PC”)
  3. Click Add Host

βœ… Your IP is now authorised to connect


Step 3: Confirm Access

  • Your IP will appear under Manage Access Hosts
  • You can edit or remove it at any time

Important Notes

⚠️ Dynamic IP Addresses

If your IP changes frequently:

  • You will need to update it each time
  • Consider using an SSH tunnel instead (see below)

⚠️ Wildcards

  • Although shown in cPanel, wildcard IPs (e.g. %) are not supported

Security Warning

⚠️ Direct MySQL connections are not encrypted

  • Your database credentials are sent in plain text
  • This can be vulnerable to interception

βœ… Recommended Alternative: SSH Tunnel

For improved security, use an SSH tunnel:

  • βœ… Encrypts your connection
  • βœ… Avoids exposing database credentials
  • βœ… More reliable for remote access

πŸ‘‰ Firstserv provides SSH access on port:

722

Summary

  • MySQL runs on port 3306
  • Add your external IP via Remote MySQL in cPanel
  • Dynamic IPs require frequent updates
  • Direct connections are not secure
  • βœ… Use an SSH tunnel for best security

Need Help?

If you’re unsure how to connect securely or need help setting up an SSH tunnel, the Firstserv support team is always happy to assist.

Β 

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Enable Redis on a Premium PCI-DSS compliant plan

Using Redis on Firstserv Hosting What is Redis? Redis (Remote Dictionary Server) is an...

Shell access to your server using SSH (PuTTY for Windows)

Accessing Your Server via SSH (Firstserv Guide) All Firstserv...

Enable or disable SSH (Secure Shell) access

Enabling SSH Access (Firstserv Guide) Firstserv provides secure,...

Connect to MySQL using MySQL Workbench

Connecting to MySQL via SSH Tunnel (Firstserv Guide – MySQL...

Block bad spiders to save bandwidth

Blocking Bad Bots & Search Crawlers (Firstserv Guide) Search...