MySQL utilizes the client-server model of communication between a MySQL Client and a MySQL Server. For a MySQL Client, we can consider every website, script, open source web application (such as Wordpress, Joomla, Drupal, etc.), or third party software used to connect and manage databases (such as phpMyAdmin). As for the MySQL server - it is always the MySQL service running on the Web Hosting Server where your Web Hosting Account with us is being hosted. When the MySQL client connects to the MySQL server a MySQL connection is being utilized.
When the MySQL Client is hosted on the same server where the MySQL Server is, then the performed connection is considered a local one since the connection happens within the same hosting environment and does not leave the server.
However, when the MySQL Client is located elsewhere (for example, on your local computer or even another Web Hosting Server) and it is connecting to the database hosted on your Web Hosting Account with us, the connection is considered a remote MySQL connection.
A good example of a remote connection is when a programmer is using a local IDE to write some code for a dynamic website. He needs to utilize a MySQL database, but the same is hosted on a Web Hosting Account with HostArmada. To connect to that database from the IDE, the programmer configures the database credentials into the IDE and then connects to the database. Naturally, the connection is considered "remote" as the connection is initiated from "outside" the Web Hosting Server. However, if, at some point, the programming of the website is completed and the code is uploaded to the Web Hosting Server, the connection will become local since it is then performed from "inside" the same server where the database is being hosted.
Now that you understand how MySQL connections are categorized let's discuss how these connections are being secured. As we mentioned in our example above, every MySQL Client has to authenticate in front of the MySQL Server. The authentication is achieved with MySQL credentials - namely - a username and a password. Although the authentication is sufficient enough to protect access to a database, there is another layer of security that is actually the main subject of this tutorial - how to restrict remote access to a database at an IP Address level.
cPanel provides you with the option to manage the allowed for connections IP addresses. In fact, by default, the only allowed connections to your databases are indeed those initiated from within your Web Hosting Account (local connections). Therefore, in order to connect remotely, you will have to "allow" the remote IP address that will connect to your databases. This could be either your local computer's IP address or the IP address of any other computer that should be connecting.
Let's see how that can be achieved.
To begin managing the allowed IP addresses for connections to your databases you will first have to access the "Remote MySQL" feature of cPanel. To do that, first, you will have to login to the cPanel service for your web hosting account. If you are not familiar with how to achieve that please check our other tutorial about How to access the cPanel service.
Once logged into cPanel, you should see all the features cPanel has to offer. The "Remote MySQL" feature is located within the "Databases" feature group which you should be able to easily locate.
Clicking on the feature will redirect you to a brand new page where further information on the feature will be provided, as well as the management tools for the allowed IP addresses.
The "Remote MySQL" page interface is relatively simple to understand, making the process of managing the allowed IP addresses for connections to your databases pretty simple. The first section of the page is called "Add Access Host". In this section, you will be able to easily add new IP addresses. Let's review the procedure.
The first field you will have to fill is called "Host (% wildcard is allowed)". In this field, you will have to enter the actual IP address allowed for connections to your databases. For example, if you are allowing access to your local computer you should be aware of your local IP address, however in case you are not, please check your IP address using any free online IP checker.
When you know the IP address, then please go ahead and insert it into the "Host" field. Please note that the field also accepts wildcard entries. For example, if your local IP address is, let's say, 78.79.80.81 and you know that it is dynamic, meaning that it may often change, you can use the "%" sign to replace a range of IP addresses. Let's say that the range within which your IP address changes is between 78.79.80.0 and 78.79.80.255. To allow that whole range, please input 78.79.80.%. As you can see, we have replaced the last group of digits in the IP address with the sign indicating a wildcard.
Next, please enter a comment for this IP address. Although comments are optional, we strongly recommend that you type in who owns the allowed IP address to save yourself some headaches if something bad happens. Considering our example, let's add a comment like "My Home IP Address".
Finally, please click on the "Add Host" button so the IP address can be allowed for connections.
cPanel will add the IP address and it will display a message that indicates the success or any error in the process of adding the IP address. Please go back to the "Remote MySQL" page by clicking on the "Go Back" link.
As you might have already noticed, the IP address you have just added will immediately appear in the next section called "Manage Access Hosts". In this section, you will find all IP addresses that are allowed to connect to your web hosting account. Please note that by default, the IP address of the Web Hosting Server where your account is located is already allowed in that list. Please do not remote that IP address or you might experience a MySQL connectivity issue for the websites on your cPanel Web Hosting Account.
In this section, you will see a simple table with three columns:
You will be able to update the Comment for each IP address and, of course, delete it, should you need to. Please note that cPanel does not offer options to edit any of the allowed IP addresses. To edit an IP address, you will have to first delete it and then add it again.
That is all! You are now well aware of how to allow new IP addresses to connect to your databases remotely. In case you are experiencing any technical difficulties adding new IP addresses or this tutorial was not sufficient enough to explain how the process, please feel free to contact our Technical Support Team and request assistance regarding the IP address you are unable to add or connect remotely to your cPanel web hosting account. They are available 24/7 at your disposal via ticket and chat.
Nikola is an accomplished tech-savvy extraordinaire with over six years of experience in the web hosting field. He started as a customer care representative and quickly rose the ranks to become a support supervisor and, eventually - the head of the technical department in HostArmada. His deep understanding of the client's needs, combined with his technical knowledge, makes him the perfect man to create the ideal harmony between client satisfaction and professional problem-solving. You will often find him creating helpful tutorials, articles, and blog posts that help existing customers get around.