How to connect to your MySQL database remotely (Remote Database Access)
This guide explains how to use Remote MySQL (called Remote Database Access in current cPanel) to connect to your hosting database from outside the server, for example from HeidiSQL, MySQL Workbench, DBeaver, a desktop accounting app, or another server. By default, databases on our hosting only accept connections from the server itself, so you must allow your IP address first.
localhost. Remote access is only for tools and apps running outside the server. If you just want to browse tables, phpMyAdmin in cPanel is easier and safer.Step 1: Make sure you have a database and user
If you do not have one yet, follow how to create a MySQL database and user in cPanel. Note that names are prefixed with your cPanel username, for example cpuser_shop and cpuser_admin.
Step 2: Allow your IP address
- Find your public IP address (search "what is my IP" in Google).
- Log in to cPanel and open Remote Database Access (or Remote MySQL) in the Databases section.
- In Host, enter your IP address, for example
203.0.113.25. Add an optional comment such as "Office" and click Add Host.
%, which allows the whole internet to try your database password. Most home and mobile internet connections in Egypt use dynamic IPs that change; if yours changes, update the entry instead of opening everything. Use a long, unique database password.Step 3: Connect
- Host: your domain name or the server hostname/IP from your welcome email.
- Port:
3306. - Username and database: the full prefixed names.
From a command line:
mysql -h example.com -P 3306 -u cpuser_admin -p cpuser_shop Safer alternative: an SSH tunnel
If your account has SSH access, you can connect through an encrypted tunnel without opening port 3306 to your IP:
ssh -p PORT -N -L 3307:127.0.0.1:3306 cpuser@example.com Keep that window open, then connect your MySQL tool to host 127.0.0.1, port 3307. Many tools such as HeidiSQL and DBeaver have a built-in "SSH tunnel" option too. See how to use Terminal and SSH access and how to use SSH keys.
Common problems
- "Can't connect to MySQL server" / timeout: the server firewall may block port 3306 for your network, or your IP changed. Check your IP again; if it is correct, open a ticket so we can check the firewall.
- "Access denied for user": wrong password, the user is not added to the database in MySQL Databases, or you forgot the username prefix.
- "Host is not allowed to connect": the IP in Remote Database Access does not match the IP you are connecting from.
Frequently asked questions
Can I give remote access to my developer?
Yes. Add the developer's IP, create a separate database user for them, and remove both when the work is done.
Can I use remote MySQL for a heavy external app?
Shared hosting has resource limits, and remote queries count toward them. For a busy external application, a VPS is a better fit.
Is the connection encrypted?
A plain MySQL connection may not be encrypted, which is why the SSH tunnel is the recommended option.