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
- Log in to cPanel
- Navigate to:
Databases β Remote MySQL
Step 2: Add Your IP Address
- Enter your IP address in:
Add Access Host
- (Optional) Add a comment (e.g. βOffice PCβ)
- 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.
Β
