Posted by: paragon | March 10, 2007

Remote MySQL Connection to a cPanel server:: How To

Remote MySQL Connection :: How To
Can I remotely connect to mysql? YES!
Follow these simple instructions to remotely connect to mysql.

Before you can connect to MySQL, You must enable your computer as an access host. It may sound confusing, but CPanel makes this ver simpe. First, login to cpanel using Then, on the main menu of CPanel, click [MySQL]. Now, scroll down to about mid way through the page until you see “Access Hosts:”. Under that, you will see a list of all the IPs that are permitted to connect to your mysql databases. As default, only “localhost” will be listed. Directly under that, you will see “Host (% wildcard is allowed):” with a text field next to it. In that text field you can enter your computers IP address. After you enter your IP address, click [Add Host] and your done. Your computer can now remotely connect to your mysql database(s).

How can I find out my computers IP address?

– Simple, just go to Wait a minute, my IP constantly changes!

Okay, you have a dynamic IP address. Therefore, everytime 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 “Allowed Hosts” in CPanel (under MySQL) everytime your IP changes. However, you do have other options available. However, you could simply enter “%” (a percentage sign) in the “access hosts” text filed in CPanel (under mysql). This would allow any IP to remotely connect via mysql. Another option: Lets say the first three parts of your IP never change. Then, you could enter 93.138.%.% , where the first two parts are your actual IP address numbers.

After your IP is added to the Access Hosts list:

First, you will have to create a mysql database and assign a user to it. Please see documentation on how to do this, as this article will assume you already have a database setup. Your username and password will be the username and password of the user assigned to the database.

Database name = cpanelusername_databasename

Database username = cpanelusername_databaseusername

MySQL Connection Port = 3306

* The database name and username is clearly displayed in CPanel, in the MySQL area.

Aggregation: ParagonHost, LLC“World Class Internet Services”


  1. This doesn’t tell me how to get the host that needs to be used to connect to the mysql database remotely. How would I figure out what the Host needs to be for cpanel installation as nothing I’ve tried works?

  2. Nathan, check out your firewalls (IPTables) and allow the IPs across the two servers.

  3. Oh u helped me so much..
    For 2 days i was hanged on this problem (about Wildcard)

    Really my problem was to give access for client to use my java applet which uses mysql

    If there is any bad effect on keeping (%) as wildcard then plz tell me other wise it’s ok

    U made my day man!

    Great post ! Thank u so much
    I love this post Really appreciated

  4. […] ちなみに自動作成されたデータベースではなく、新たにデータベースを追加するか既存のデータベースにアクセスする場合は以下を参照。 Database name = cpanelusername_databasename Database username = cpanelusername_databaseusername MySQL Connection Port = 3306 (「Remote MySQL Connection to a cPanel server:: How To « |」より引用) […]

  5. […] Remote MySQL Connection to a cPanel server:: How To « | […]

  6. This blog entry is old, however I found it so someone else having the same trouble I was having will be able to as well. I have found a fix for the dynamic IP address problem:
    Simply add the ip address you want to use and replace the following occurrences USERNAME, PASSWORD, DOMAIN & SKIN with your cPanel details. When this PHP code is run it will add the IP address to your cPanel IP addresses. I have mine in a script which obtains my internet IP address and then adds it automatically via crontab.

    $realIP= IP address you want to add
    fopen(“http://USERNAME:PASSWORD@DOMAIN:2082/frontend/SKIN/sql/addhost.html?host=$realIP”, “r”);

    hope this helps anyone who needs it!

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: