Knowledge Base

How to Remotely Connect to the MySQL Database

Did you find this article helpful?
Copy Link

* Your feedback is too short


Allowing remote MySQL connections is often done to enable a program on your personal computer to access a database on the server.

If you remotely connect from your home computer, you need a MySQL client like Navicat, phpMyAdmin, Workbench, or Dreamweaver. For some suggested programs and more details, please see:

Here are the topics discussed in this article.

How to enable your computer as an access host

All IP addresses are blocked and added to a list to access the server by default. So, before connecting to MySQL from another computer, the connecting computer must be enabled as an Access Host.

Please note that having a dynamic IP address means the connecting IP address can change periodically, depending on the Internet Service Provider (ISP). You must update the connecting IP in Remote MySQL every time it changes.

Many of our servers block port 3306 inbounds. If you are getting a Connection Refused error when connecting, please contact us via phone or chat requesting that we open port 3306 for your IP to connect to MySQL remotely.

How to manage IP address as an access host


To add your computer as an access host:

  1. Log in to cPanel. There are two ways to access your cPanel.
    • Option 1: Access your cPanel directly.
    • Option 2: Access your cPanel via your Customer Portal.
      1. Log in to your Customer Portal.
      2. Click Hosting in the left-side menu.

        Customer Portal - Hosting menu

      3. If you have a single hosting package in your account, scroll down to the Quick Links section.

        If you have multiple hosting packages in your account, locate the hosting package you want to manage on the Hosting Packages page, then click its Manage button.

        Hosting tab - Manage button

      4. Under the Quick Links section, click the cPanel button.

        Hosting menu - Quick Links - Launch cPanel

  2. Within cPanel, go to the Databases section, then click on the Remote MySQL® icon.

    cPanel - Remote MySQL

  3. On the Remote MySQL® page, enter the connecting IP address in the Host field, then click Add Host.

    Remote MySQL - Add IP Address

    To know your current local IP address, please visit google.com/search?q=what+is+my+ip or use Google to search for 'what is my IP.' Google will display your IP Address in the search results. Please note that this feature is only available in English.

To remove a host from accessing databases on your server:

  1. Click the Remote MySQL® icon under the cPanel’s Databases section.

    cPanel - Remote MySQL

  2. Locate the IP address you wish to remove.
  3. Click the Delete icon on the right-hand side of the IP address.

    Remote MySQL - Remove IP Address


If you have Windows hosting, you will need to whitelist your IP. Please follow the instructions in the following article.

Configuration settings for your database

Use the following configuration settings to connect to your database.

Hostname Use the server IP address or server name. Please refer to this article to find your server address: What is My Server Address?
Database Name Use the first 8 characters of your cpanelUsername_databaseName.

cPanel username: snappygator
Database name: exampledatabase

Database Username Use the first 8 characters of your cpanelUsername__databaseUsername.

cPanel username: snappygator
Database username: exampleuser


Database Password The password you entered for that database user.
MySQL Connection Port 3306
TCP or UDP TCP or UDP. Either of the two is fine.

To learn more about adding a connection string to your Perl or PHP code using these configuration settings, please see the following article:

How to access your databases

After whitelisting your local IP, you should make the proper remote MySQL connection. Be sure that the username and password you will use match the ones created in the MySQL Database section of cPanel. The most common problem in connecting is due to using an incorrect username and password.

For more examples of common MySQL errors, please see the related article:

Frequently Asked Questions

What is a MySQL database server?

MySQL is an open-source management system used to create and manage databases. A MySQL server is like a database engine where you can store data and access and maintain those data systematically and efficiently.

How to add a user to access the MySQL database?

Aside from the configuration settings needed to connect to a MySQL database remotely, users must also have certain privileges. Please refer to these articles to learn more about granting privileges to users and configuring connection settings.

How to allow remote access to a MySQL server?

The MySQL server communicates only from the localhost by default. It can only be accessed by applications running on the same host. Remote access is necessary to remotely access the database from an application running on a different machine or host.

To remotely connect, you must get your connecting computer enabled as an Access Host by whitelisting your local IP address. You will also need to identify your configuration settings, as shown above.

How do you find the MySQL hostname?

The MySQL Hostname is the location of your MySQL server and database. This information is needed to connect to your MySQL server remotely. Localhost is used by default as the hostname. You are accessing your database on the same server where your application is, like WordPress. Your hostname is found in your directory root’s wp-config.php file for a WordPress site.

Example of WordPress Hostname

To remotely access the database, you may want to use your server IP address or server name instead of localhost to initiate a connection.

How do you restore a MySQL database?

The cPanel has a feature to restore a MySQL Database backup. The following article outlines the instructions for restoring a MySQL backup.

Alternatively, you also have the option to do a restoration through your cPanel’s phpMyAdmin by importing your backed-up MySQL database file. Please refer to the article below for instructions. A video guide is also included in the article to assist you with the whole process.


Did you find this article helpful?
Copy Link

* Your feedback is too short