Connecting to a remote database server is a common thing to do for dba, database architect, web developer, application developer etc.
Here are the basic stuffs you need to know:
– If connecting from your home computer, you need a MySQL client like Navicat, phpMyAdmin, Dreamweaver, Netbeans, Visual Studio etc.
Basic Configuration Settings
Host = (use the server IP address)
Database name = (cpanelusername_databasename)
Database username = (cpanelusername_databaseuser)
Database password = (******)
MySQL Connection Port = 3306
TCP or UDP, either is fine.
Access Host Configuration
Also, before you can connect to MySQL from another computer, you must enable your computer as an Access Host. It may sound confusing, but if you’re using cPanel, this step is really simple.
1. Goto cPanel. Search for “Remote MySQL“. You will see the following user interface.
2. If you connect to the internet using a constant ip address, add that ip address as an access host. Read step 3 only if you have a changing/dynamic ip each time you connect to the internet.
3. 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, that sounds like a lot of work and 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.
Connect To Remote MySQL Server with Netbeans
In one of my previous post, how to connect to remote mysql server with netbeans, I showed how this is done in netbeans with pictures laid out clearly, but note that you still have to set your access host (as discussed in this article above).