How to Set up a Remote MySQL Connection in cPanel

The typical MySQL database connection is either server to server, meaning a connection from an application on a website to a database server in the same network, or a localhost connection, which is a connection from a website application to a database running on the same server.

But there are times you will need to make a “remote connection,” a connection to the database server from outside the network where the web application runs. For example, connecting to a database from your home or office for development purposes, or to make local database backups.

Most commercial hosts block outside database connections as a security measure, so in order to access a database, you have to add your home IP address to a remote access list. This tutorial will show you how to add your remote IP address (called an “Access Host”) to the Access Host list in cPanel.

Adding a Remote MySQL Connection in cPanel

Log in to cPanel, and in the “DATABASES” section, click the “Remote MySQL” link or icon.

cPanel set up remote MySQL access step 1

In the “Add Access Host” section, make an entry in the “Host (% wildcard is allowed)” field.

That entry can be:

  • A hostname (e.g., corp.company.com)
  • An IPv4 address (123.456.78.9 format)
  • An IPv6 address (2600:156c:404d:d4f9:627f:e3b6:6c50:d40a format)

If you don’t know your IP address, you can go to Google and type “What is my IP” and in most cases, Google will display your IP. Alternately, you can go to one of the advertising-supported IP detection sites like whatismyip.com.

The “Comment (optional)” field is a place to make a note such as, “Office host,” or “Home IP.”

Click the “Add Host” button.

cPanel set up remote MySQL access step 2

If the entry was added you’ll see a success dialog.

Click the “Go Back” link.

cPanel set up remote MySQL access step 3

In the lower section of the Remote MySQL page, you’ll see a list of the addresses you’ve added under “Manage Access Hosts.” From here you can edit or delete an entry.

cPanel set up remote MySQL access step 4

If there is an entry in the list that you don’t recognize, check with your host before deleting or editing it. The entry may be necessary for proper MySQL integration with your website. If that’s the case, you may want to add a “Do not delete” note to the entry made by your host.

Maintaining Remote MySQL Connections in cPanel

As you’ve seen, it’s pretty easy to add remote MySQL access in cPanel, but what about maintaining it? If you’re security-minded—as we all should be—you may want to schedule a periodic check your Access Host list in order to review or remove unused connections.

What are some of the reasons you make remote connections to MySQL databases? Have you ever checked your cPanel Access Host list to review the entries?

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.