How to Connect to a Remote MySQL Server?

0
1669

Connecting to a remote MySQL server from your client system can enable you to connect to a database that does not run on your server. We developed this post to give you tips and suggestions on how to connect to a remote MySQL server.

Preparation Before Connecting Remotely

To make you full-prepared ahead of time, an IP address which can approach to the database is needed. If you intend to connect to the database from the current connection, you may need to type http://www.whatismyip.com in your web browser to get an idea of your current IP address.

Preparation Before Connecting Remotely

Furthermore, in order to connect to your database, you need to do some configuration settings. Pay attention, all the following settings listed can be approachable in the configuration.php that is located at your site’s installation in the folder.

  • Host Name – Your own webserver’s IP address.
  • Database Username – Your MySQL database’s name.
  • Database Name – Your MySQL database’s username.
  • Database Password – You need it to enter for database user.

Besides, opening up the connection port of 3306 MySQL in the webserver’s firewall is needed. After you have done the preparatory work mentioned, you can connect remotely with the following tips.

Authorize MySQL Connection in the cPanel Interface

By default, remote access to the MySQL database server is disabled to avoid possible security problems that are in potential. In other words, all IPs actually are initially banned and need to be added into your “Access List” to approach to the website server. Hence, the computer that connects to a MySQL database from another place needs to be authorized from interface of the cPanel. For details, please log in your cPanel, here you can see the “Databases” section, below which, “Remote MySQL” is right there. Then click “Remote MySQL”.

Authorize MySQL Connection in the cPanel Interface-1

Now you can see a fresh page on the screen as below, then you can authorize the connecting computer in the “Remote MySQL” section by filling the mentioned “IP address” or “Host Name” in the field below “Add Access Host”. Do remember to click “Add Host”, or it won’t work. By this time, the IP address filled in has been already added to the remote IP connections. At the same time, you are able to operate a remote connection to a MySQL database. If needed, you can add IP addresses as many as you want.

Authorize MySQL Connection in the cPanel Interface-2

Note that: If you put wrong IP address or we say hostname by mistake and want to give up, you can remove them from the “Access Hosts” list. Just click the “Delete” option below the “Remove” area.

Authorize MySQL Connection in the cPanel Interface-3

Add Wildcard to Enable Dynamic IPs

In many conditions, you may call for wildcard for the IP addresses that may change now and then. As thus, though without user input, these connecting dynamic IP addresses still can be updated in “Remote MySQL”. To do this, you can add a % mark in the end of the area. If it’s necessary for you to list all the IPs in the scope 123.45.67.1 to 123.45.67.888, you can present the address of this IP as 123.45.67.%.
Add Wildcard to Enable Dynamic IPs

Some Programs That May Help You to Do Remote Connection

There are a number of programs that you can make use of to help you remotely connect to a database in the online market. You should remember that which database management program to choose depends on the very database that you’re planning to connect to. There are some resources that are free and open programs, such as DreamWeaver and MySQL Workbench.

What to Do When You Confront the Remote Connection Problem?

You may encounter such a situation that you cannot connect to the database unexpectedly with a remote connection tool. If this happens, you are faced with an error known as 1045. The following are some practical solutions that may help you to solve this problem.

Re-check the Password of cPanel

re-check the password of cPanelIf you operate remote connection to database with the username and password of cPanel, it is very likely that your cPanel password causes the connect error you confront. This happens when you reset your cPanel password but not change it timely in the “Remote MySQL” settings. Then you should check and modify your cPanel password.

Inspect Your IP Address

In fact, majority of public IP addresses are changed periodically from the Internet Service Providers. Therefore, though you have a program, you may find you are still cannot to approach to the database. To get out of this frustrating situation, go to the websites mentioned above and check the present IP address. At the same time, you also need to return to the “Remote MySQL” section and add this changed IP address in the “Access Host” list.

If the above methods still don’t work, then we suggest you ask for professional help from our support experts. We are standing by 24×7 to offer help.