Database connection errors are one of the more common errors seen on a website. They also seem to cause a bit of panic. When you receive this error message, it means that the program is not communicating properly with the MySQL database service on the hosting server. This article will help you determine if the issue is your hosting server itself, or if you need to check the configuration settings for the connecting program.

TelNet Test

We want to do a test known as the TelNet test. This allows us to test the server without going through the program that was giving the error. This way, we can tell if the MySQL database service is running on the server. Telnet is a network protocol that you will use to connect to the server directly.

  1. From a windows machine, access the command line from start -> run -> cmd. If you are using a Mac, open up the Terminal application.
    Telnet is disabled by default on newer versions of Windows. If it is disabled on your version, you will receive a message stating something similar to 'telnet' is not recognized as an internal or external command, operable program or batch file. You can enable telnet by following the instructions in our article named How to enable Telnet on Windows machines.
  2. From inside the command prompt, type the command telnet <domain name> 3306. Telnet is the command to open the telnet protocol, the domain name is the name of the domain you want to contact, and 3306 is the specific port for MySQL for Web Hosting Hub. Be sure to replace <domain name> with your actual domain name. You can see an example of how it should appear below.

    telnet 3306
  3. Hit enter to activate the command. If the MySQL service is running, you will receive a response from the server. Although it appears cryptic, it is a confirmation beginning with the MySQL version number. If MySQL is not available on your server at the moment, you will receive a connection error.

    MySQL Service available


  4.   MySQL service unavailalbe
    Connecting to not open connection to the host, on port 3306: Connect failed.

Check Program configuration files

If you get the response that indicates the MySQL service is indeed up and running, the next thing to check is whether the credentials the program is using match the server. You will need to know the database name, username, and password the server is expecting and the database name, username, and password the program is using to try and make the connection.

To find the credentials the program is using, look for the database settings found in your program files. If you are unsure where to find the database connection credentials for your program, you can check our configuration file location list for your particular program. Be sure you write down the location of the file and the database credentials you find.

After finding the credentials in the program, you want to see if they match the ones in the cPanel. To find the database information in the cPanel just follow these steps:

  1. Log into your cPanel account.
  2. Find the Databases category. Click on the MySQL Databases icon.
  3. Once in the Databases page, scroll down and find your database in the list. You will also see the database user name next to it.
  4. Once you have confirmed the database and username, you will need to confirm the password. As there is no way to see the password, you will need to first delete, then re-create and attach the database user to the database with the password.

After ensuring the credentials are the same between the server and the configuration file, test your website again. If you are still receiving the database connection error, you will want to contact our Live Support team for further assistance.

Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve this article:
Email Address

new! - Enter your name and email address above and we will post your feedback in the comments on this page!

Did you find this article helpful?

Post a Comment

Email Address:
Phone Number:

Please note: Your name and comment will be displayed, but we will not show your email address.

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Need More Help?

Help Center Search

Current Customers

Email: Ticket: Submit a Support Ticket
Call: 877-595-4HUB (4482)
757-416-6627 (Intl.)
Chat: Click To Chat Now

Ask the Community

Get help with your questions from our community of like-minded hosting users and Web Hosting Hub Staff.

Not a Customer?

Get web hosting from a company that is here to help.