Many companies offering shared hosting services process customer requests after a general evaluation process.
Although this process may be restrictive for end users, it is quite logical when considering security, potential technical issues, and similar factors. Therefore, whenever you wish to connect to your MySQL database located on a remote server (or within a shared hosting environment) via any application (a programming language or an application), you will need to perform a set of configurations. You can find numerous explanations about remote MySQL connections online, such as in Remote MySQL Connection. However, there are a few additional steps that may differ from server to server or from hosting provider to provider, which are often overlooked or missing.
Remote MySQL Connection
You can easily perform various operations via the command line interface on a remote server, provided you have the necessary authorizations. However, when dealing with a shared hosting environment, certain operations may not be directly possible. Therefore, let’s examine how we can connect to our database located under a shared hosting environment. First, you will need to access the cPanel interface corresponding to your account.
By clicking on the Remote MySQL option under the Databases section, you can proceed to the screen where you can configure the connection settings.
If you use the % (wildcard) in the Add Access Host content on the screen, you will grant access to all requests. If you plan to connect from your computer and/or a remote server, you must define your computer’s outgoing IP address or the server’s domain/IP information. You can see examples of IP and domain access in the image above.
Simply enter the relevant IP and/or domain in the field and click the Add Host button to complete the access setup. If you wish to remove an access entry, simply click the Delete link located in the right-hand column.
Some hosting providers may have already configured these settings, but without adding your IP address to their firewall whitelist, access will still not be granted. In such cases, you must inform the relevant company about the issue and specify the IP address you wish to connect from.
To access your server details, you can click the Server Information link under the General Information section on the right-hand side of your cPanel screen. Here, you can use the Server Name and Dedicated IP Address information for access purposes. Additionally, if you cannot access these details via cPanel or wish to verify their accuracy, you can connect via SSH and perform a MySQL login to verify the server/port information.
SHOW VARIABLES WHERE Variable_name = 'hostname'
SHOW VARIABLES WHERE Variable_name = 'port'
After completing all these steps, you can enter the relevant information for the programming language or tool you intend to use. Within the scope of this article, I will establish a database connection using Tableau Desktop.
Remote MySQL Access from Tableau Desktop
Tableau Connect section, under the To a Server heading, enables you to quickly establish MySQL connectivity1.
Enter your server’s hostname/ip, port, and password details to view the database and tables.
After verifying the accuracy of the information and confirming access permissions, you can view your database and tables and easily continue your operations through the application.