cPanel provides you the ability to connect to the databases on your account from another location. We are happy to offer Hostwinds clients the ability to use this feature in our Shared and Business web hosting services. You can use any software that can connect to a MySQL database and then modify and update the database through the software making managing your database even easier for you to do. This article will go over how to enable Remote MySQL access for your account.
Enable Remote MySQL
First, login to the Client Area and click the Manage button next to your shared or business hosting package.
Then click on the Login to cPanel on the left side of the page.
Adding MySQL Remote Access Hosts
To be able to utilize Remote MySQL, you will need to add the connecting IP to the whitelist for your account. This can be done through the cPanel under the Remote MySQL icon in the Databases section.
Once on this page, you’ll want to enter the host’s name (fully qualified domain name) or the IP of the system making the connection and click Add Host. Once you have added the host IP, just click on ‘Add Host.’
You may use the percentage sign character (%) as a wildcard. For example, to allow access from all IP addresses that begin with 104.12.43., enter 104.17.43.%.
Once a Host has been added, you can also Delete the Access Host by clicking on the Delete button.
|Host or Server||Either 1) Your domain name or 2) Your Dedicated IP|
|Username||The database user that you have added to the database|
|Password||The database user’s password|
|Database||The name of the database|
Testing a Connection
If you would like to test the connection to your Database you can use the following code snip-it to create a PHP file that you can run. It will tell you if the connection was successful or if there was an error. Once it is connected it will close the connection.
$servername = "dedicated IP address";// Can also be 'localhost' if the file is on your hosting plan server as well.
$database = "database"; // Name of your Database you are trying to connect to.
$username = "username"; // Username of the user you wish to connect through.
$password = "password"; // Password for your user.
// Create Connection
$conn = new mysqli($servername, $username, $password, $database);
// Check connection
die("Connection failed: " . $conn->connect_error);
echo "Connected successfully<br>";
// Close the connection once finished.
echo "Connection now closed successfully";