Troubleshooting Database Connection Issues

This article lists some reasons why you cannot connect to MySQL remotely and shows you how to solve the remote database connection issues.

1> MySQL service is not running.

2> DB user does not have correct password or permission.

3> Firewall restricts IP connection on the “Security” page.

4> Remote Connection issue between your local server to our MySQL.

5> The MySQL remote connection port is blocked by your server or ISP.

6> Wrong MySQL connection information defined in application.

MySQL service is not running

1) Please check the status on the “Overview” page of your application in the Control Panel.

Check the application status

2)Running the command “ps –ef” via shell interface to check the MySQL status. The service is working if the result is as the following screenshot shows.

Check the MySQL status

If the MySQL service is not working, please use the shell tool in the Control Panel to check MySQL logs. Inputting the command “cd log/”, then “ls -a”, followed by “vi mysql_error.log” to open the log file.

Check MySQL logs

DB user does not have correct password or permission

Open phpMyAdmin in the Control Panel and check the MySQL User permission in phpMyAdmin.

Launch phpMyAdmin

1) If you cannot log in to MySQL via phpMyAdmin and get the following error, the password of the database user might be wrong.

Cannot log in to MySQL via phpMyAdmin

2) If a MySQL user can log in to MySQL via phpMyAdmin, please check if the user has remote connection permission in phpMyAdmin. The option ‘ % ’ means all hosts can connect to MySQL user. While ‘127.0.0.1’ and ‘localhost’ mean the user does not support remote connection.

Check if the user has remote connection permission in phpMyAdmin

Firewall restricts IP connection on “Security”

If you have enabled Firewall Rules under the “Security” tab, it will restrict the remote connection. Only the listed IPs will be allowed to connect to your application.

Check if your IP is restricted

Solution: You can add more allowed IPs to the Firewall(a maximum of 5 IPs or IP ranges).

Or you just stop the Firewall service to allow connections from all IPs.

Remote Connection issue between your local server to our MySQL

We can use “ping” and “tracert” commands on your local computer to test the remote connection.

1. Use Ping to check the connection issue

Get the MySQL package host IP on the Overview page in the Control Panel.

Get the MySQL package host IP on the Overview page

As our MySQL server do not allow ping function. You can ping the gateway of the MySQL package on local PC to test the connection between local PC and MySQL server. If the result is like the following screenshot shows, it is normal. If it shows time out, please check your local network.

Use Ping to check the connection issue

2. Use “Tracert” comamnd to check the connection issue

You can use the “tracert” command on most operation system to test the connection.

Mac / Linux:

Please run “yum -y install traceroute” or “apt-get install traceroute” install traceroute first.

1.Open a Terminal window.

2.Type "traceroute <mysqlhostip>" in the terminal and hit enter.

Use Tracert comamnd to check the connection issue

Windows:

1.Open the Start menu.

2.Click on Run.

3.Type "cmd" and press "OK" to open a command prompt.

4.Type "tracert <mysqlhostip>" and hit enter.

<mysqlhostip> should be filled in with your MySQL hostname or host IP. If the result is like the following screenshot shows, it is normal. If the tracert process cannot complete, please check your local network.

Check connection issues on Windows

The MySQL remote connection port is blocked by your server or ISP

We can use telnet command to test if the port is blocked by your server or ISP.

For example:

If we want to test if the port 14976 is blocked, we can use “telnet 204.2.63.41 14976” .

If the telnet command cannot be recognized on your local PC, please install a telnet client first.

To install a telnet client,

Windows server: https://social.technet.microsoft.com/wiki/contents/articles/38433.windows-10-enabling-telnet-client.aspx

Centos: # yum -y install telnet

Ubuntu & Debian: # apt-get install telnet

Install a telnet client

Wrong MySQL connection information defined in the application

Please refer to the article “Connecting to MySQL Database via Different Program Language” to check your database connection information in your codes.

Copyright © 2021 Cloud Clusters Inc. all right reserved,powered by GitbookRevised on 05/05/2023

results matching ""

    No results matching ""