Articles

How to Connect to Your MySQL Database Remotely

Connect to MySQL Remotely

You may be interested in connecting to your website’s MySQL databases remotely from an external location. In this article we’re going to show you how to use cPanel to allow external hosts to access your MySQL database; adding an access host through the control panel. Using this method will allow you to connect to your database using third party clients and tools such as HeidiSQL, phpMyAdmin, Sequel Pro to name a few.

Enabling Remote MySQL and using a tool such as HeidiSQL, phpMyAdmin, or Sequel Pro will allow you (developers) to browse and edit data, create and edit tables, run and execute SQL queries, and much much more.

If you are planning on connecting to your database remotely, we highly recommend creating a backup of your MySQL database before moving forward.

In order to connect remotely, you must submit a ticket to our support team and request that your IP address be added to your server’s allow list. When submitting a ticket, please include your IP address in the request.

Download HeidiSQL, phpMyAdmin, or Sequel Pro

Any of the three MySQL tools will allow you to connect remotely and manage your databases. In this article we’re going to use HeidiSQL (Official Site | Download Link), which is a free Open Source project that’s been in active development for over 9 years. HeidiSQL is compatible with Windows and newer MacOS X versions according to their website.

How to Add an Access Host in cPanel

Now that you’ve downloaded HeidiSQL you’ll want to log into cPanel. Once you’ve logged into cPanel you’ll want to look for the DATABASES section where you’ll find the Remote MySQL icon.

You’ll then be taken to the next page to Add an Access Host. In the blank field box you’ll want to add your IP Address as an Access Host, which will allow you to connect to your database remotely. An easy way to find out your IP is by simply searching Google for “what’s my ip” and it should return your public IP address.

After clicking the Add Host button you’ll see a message similar to the one shown here;

The host “97.90.129.25” was added to the access list.

Remember, you will not be able to connect to your database remotely until you have put in a request to our support team to add your IP address to your server’s allow list.

How to Connect Remotely to Your Database

After adding your IP address as an Access Host in cPanel you’ll want to open HeidiSQL. HeidiSQL will open with the Session Manager. This is where you’ll configure HeidiSQL to connect to your database.

Enter in your information into the session manager. You can use the Hostname or IP address of your server. In this example, I’m using the Shared IP Address of the server this particular account is on. If you do not know your server’s Shared IP Address you’ll want to log back into cPanel, click the Server Information link (right sidebar), and you’ll see a row for Shared IP Address.

Hostname/IP: Your server’s Shared IP Address

User: Your cPanel username OR Your DB username

Password: Your cPanel password OR Your DB username password

Port: 3306

ATTENTION: If you created a new DB User, don’t forget to assign that DB User privileges to the database you wish to grant access to.

After configuring your settings in the Session Manager, you’ll want to click the Open button at the bottom of the screen. If your settings are correct, you will see a new screen with your database in the left hand column. By default, the database is not expanded so you won’t see the database tables. Click the carrot next to your database name and it will expand with the tables inside of that database.

How to Remove an Access Host in cPanel

To remove an Access Host you’ll want to follow the same steps you took to add an Access Host. Log into cPanel and locate the Remote MySQL icon.

You should see the IP Address you added earlier. I added the IP Address 97.90.129.25 earlier in the article (yours will be different). Simply click the Delete button next to the Access Host you wish to remove. The next screen will ask if you are sure you want to permanently remove IP ADDRESS as an access host. Click the Remove Access Host and you will have removed that Host from the access list.

If you have any issues connecting remotely to your database please contact support or submit a ticket and our support team would be more than happy to provide assistance.

Looking for reliable Linux hosting with Award Winning Customer Support
Grab your hosting today with a 20% discount. All plans come with our 60 Money Back Guarantee!

Previous ArticleNext Article