Knowledge Base
Save up to  70% off.  Start your website today!

Connect to Your Database Remotely

Let's say you're developing a script on your PC at home, and you need to connect to your database remotely using a MySQL admin program. No problem. This procedure is a little quirky, but here are the steps to grant remote access to your database.
Note: if you don't have a database yet, start here.

We'll assume you are using the following information:

   database: example_mydb 
   database user: example_dbuser
   IP address given to your computer from your ISP: (get the IP of your computer here)
   server name: server.asmallorange.com (get the IP of your server here)

Whitelist Your IP

  1. Log in to cPanel.

  2. Scroll down to the Databases section and click Remote MySQL.

  3. Enter your IP address (eg, in the field next to Host.
    Note: if you don't know your IP go here.

  4. Click Add Host.

  5. You can enter something like 1.2.3.% if you want to allow a range if IP addresses.

    Note: this is not safe; it will allow anyone in that entire network range to have access to your database if they are able to obtain your password.


Add User to Database

  1. Scroll back down to Add Users to Your Databases.

  2. Select the user 'example_dbuser' from the dropdown menu on the left, and the database 'example_mydb' from the dropdown menu on the right.

  3. Click Add User to Database.

Testing your Connection

Now, using your PC and remote MySQL client, enter the connection information for your database, database user, and the server name or IP address.

Remove User from Database When No Longer Needed

  1. Scroll up to the Current Databases and look for the database 'example_mydb.'

  2. You'll see two delete buttons, one next to the database name (example_mydb) and one under that next to the username (example_dbuser).

  3. Click the Delete next to the database username.

    The next screen says:
    Account Removed from Access List
    Deleted the user example_dbuser from the database example_mydb. 

Next Steps

You've enabled remote access... now what? 

You will need a third party application to connect to MySQL remotely, like MySQL Workbench, phpMyAdmin (available in your cPanel) or Navicat, or even Dreamweaver and similar.

See also Find the IP Address of Your Server

Did you find this article helpful?

* Your feedback is too short