Back to Shared Hosting Docs

    Remote MySQL Access

    Connect to your MySQL databases from external locations

    What is Remote MySQL Access?

    Remote MySQL access allows you to connect to your database from locations outside your server, such as your local computer, another server, or a desktop database management tool.

    Why Use Remote Access?

    Development

    Work on database locally

    Desktop Tools

    Use MySQL Workbench, TablePlus, etc.

    Backups

    Automated external backup scripts

    Data Migration

    Transfer data between servers

    Reporting

    Connect BI tools to live data

    Security Considerations

    • Remote access opens your database to external connections
    • Only whitelist trusted IP addresses
    • Use strong database passwords
    • Consider SSH tunneling for better security
    • Disable when not actively needed

    Enabling Remote MySQL Access

    1Find Your IP Address

    • • Google "what is my ip" to find your public IP
    • • Note: Dynamic IPs change periodically
    • • Static IPs are preferred for consistent access

    2Access Remote MySQL

    1. Log in to cPanel
    2. Navigate to "Databases" section
    3. Click "Remote MySQL"

    3Add Access Host

    1. In the "Add Access Host" section
    2. Enter your IP address or hostname
    3. Click "Add Host"

    Accepted Formats:

    192.168.1.100 - Specific IP
    192.168.1.0/24 - IP Range (CIDR)
    192.168.1.% - IP Range (Wildcard)
    example.com - Hostname

    Connection Information

    To connect remotely, you'll need:

    Host

    Your domain name or server hostname

    Port

    3306 (default MySQL port)

    Username

    Your MySQL username (e.g., cpanel_dbuser)

    Password

    Your database password

    Connecting with Desktop Tools

    MySQL Workbench

    1. Open MySQL Workbench
    2. Click "+" to add new connection
    3. Connection Name: Give it a name
    4. Hostname: your-server.com
    5. Port: 3306
    6. Username: your_database_user
    7. Click "Store in Keychain" to save password
    8. Test Connection
    9. Click OK

    TablePlus

    1. Create new connection
    2. Select MySQL
    3. Name: Connection label
    4. Host: your-server.com
    5. Port: 3306
    6. User: database_username
    7. Password: your_password
    8. Database: database_name (optional)
    9. Test and Connect

    HeidiSQL (Windows)

    1. Click "New" session
    2. Network type: MySQL (TCP/IP)
    3. Hostname: your-server.com
    4. User: database_user
    5. Password: your_password
    6. Port: 3306
    7. Click Open

    Connecting via Command Line

    MySQL Client:

    mysql -h your-server.com -u username -p database_name

    Export Database Remotely:

    mysqldump -h your-server.com -u username -p database_name > backup.sql

    Import to Remote Database:

    mysql -h your-server.com -u username -p database_name < import.sql

    SSH Tunnel (More Secure Method)

    SSH tunneling provides encrypted connection without opening MySQL port publicly.

    Setting Up SSH Tunnel:

    ssh -L 3307:localhost:3306 username@your-server.com

    Then Connect via Tunnel:

    • Host: localhost (or 127.0.0.1)
    • Port: 3307 (local tunnel port)
    • Username: database_user
    • Password: database_password

    Troubleshooting Connection Issues

    Error: "Host is not allowed to connect"

    • • Your IP not whitelisted in Remote MySQL
    • • Check your current IP: whatismyip.com
    • • Add IP in cPanel Remote MySQL
    • • IP may have changed if dynamic

    Error: "Access denied for user"

    • • Wrong username or password
    • • Verify credentials in cPanel MySQL Databases
    • • Check username includes prefix
    • • Ensure user has permissions for that database

    Error: "Can't connect to MySQL server"

    • • Wrong hostname or port
    • • Firewall blocking connection
    • • MySQL service down (rare)
    • • Try SSH tunnel instead

    Connection Times Out

    • • Server firewall may be blocking
    • • Port 3306 might be filtered by ISP
    • • Try SSH tunnel on port 22
    • • Contact support if persistent

    Security Best Practices

    IP Whitelisting

    • • Only add IPs you control
    • • Use specific IPs, not wildcards
    • • Remove old/unused IPs regularly
    • • Avoid % wildcard (allows anyone)

    Strong Authentication

    • • Use complex database passwords
    • • Different password per user
    • • Regular password rotation
    • • Never share credentials

    Connection Security

    • • Prefer SSH tunneling
    • • Use SSL/TLS for MySQL
    • • Monitor access logs
    • • Disable when not needed

    Common Use Cases

    Local Development

    Connect local application to remote database, test code against production data

    Database Management

    Use advanced tools not available in phpMyAdmin

    Automated Backups

    Schedule local backups via cron/scheduled tasks

    Multi-Server Applications

    Application on one server, database on another