How to connect to the MySQL server remotely

Please note that Users on Shared servers are no longer permitted to use remote MySQL connections in order to ensure the security of the other customers on the same server. This guide pertains to Dedicated and VPS customers running Linux servers with cPanel.

Note: If connecting from your home computer, you need a MySQL client like Navicat, phpMyAdmin, or Dreamweaver.

Configuration Settings:

Host name = (use the server IP address)
Database name = (cpanelUsername_databaseName)
Database username = (cpanelUsername_databaseUsername)
Database password = (whatever you picked)
MySQL Connection Port = 3306
TCP or UDP, either is fine.

Before you can connect:

Many of our servers block port 3306 inbound, if you are getting a "Connection Refused" error when trying to connect please submit an email to support@sasahost.co.ke requesting that we open port 3306 for your IP address to be able to connect to MySQL remotely.

Also, before you can connect to MySQL from another computer, you must enable your computer as an Access Host. It may sound confusing, but cPanel makes this very simple.

  1. When using X3, login to cPanel and click the Remote MySQL icon, under Databases.
  2. Type in the connecting IP address, and click the Add Host button.
  3. All done, try connecting remotely.

-or-

  1. When using X, login to cPanel and click the MySQL Databases icon, under Databases.
  2. Scroll all the way to the bottom and type in the connecting IP address where it says "Host (% wildcard is allowed):", and click the Add Host button.
  3. All done, try connecting remotely.

Wait a minute, my IP constantly changes.

Okay, you have a dynamic IP address. Therefore, every time you go online, or every once in awhile, your IP changes. You have a few options here. The most secure, would be to update your IP in Remote MySQL every time your IP changes. However, you do have other options available. You could simply enter % (a percentage sign) in the Add Access Hosts text field. This will allow any IP to remotely connect to your databases. Another option: Lets say the first two parts of your IP never change. Then, you could enter 93.138.%.% , where the first two parts are your actual IP address numbers.


IMPORTANT UPDATE ! Since the 11.25 update, we've noticed a bug where you add an IP to the MySQL remote access list, only to find that the corresponding MySQL user that is created does not have any privileges.

In order to get the correct privileges added, you must go back to your MySQL Databases section in cPanel and re-add the user to each database (reassign the privileges). No need to remove the user first; just select the user and the database from the drop-downs and click "Add".

Was this answer helpful?

 Print this Article

Also Read

How to connect to the MySQL database

Configuration Settings: Host name = localhost (literally put localhost) Database name =...

Copy Entire Database or Rename Database

Is there a way for me to copy an entire database in cPanel? Is there a way for me to copy an...

MySQL database size limit

There is no limit for the size of databases. MySQL is only limited to the size of your cPanel's...

How do I create a MySQL database, a user, and then delete if needed?

Create database: If you are using any type of PHP software or keeping a collection of records...

PDO-MYSQL

If you get the message that tells you "pdo_mysql must be loaded," then do the following. You...