0 items
24/7 Support & Sales   1300 210 210
Online Support Web Hosting

I have a database connection error

A database connection error means that there is a program running on your site that cannot connect to or communicate with your MySQL database. Because it cannot retrieve the data that it needs to work correctly, it returns an error message.

There are several possible reasons why this could be happening. The following are some of them:

  • You have incorrect login credentials.
  • The MySQL is currently not active on the server.
  • There are some corrupted data in your database.
  • The entire database you need to access is corrupted.

You can check to see what the problem is and try to resolve the issues by running the following tests.

Check and modify your MySQL Configuration Settings

One reason that the program you are running may be unable to establish a connection with your database is that the username and/or password you are using may not match the configuration settings stored in the server.

If this is the case, you should make sure the configuration settings match by checking the username and its corresponding password. If you’re not certain that you remember the current password, you have the option to reset or change the password.

To check the username and be able to change your password, follow the steps below:

  1. Click on My Account at the top of the page.
  2. Select Hosting Manager from the drop-down menu.
  3. Enter your username and password, and click Log In.
  4. On the Home page, click the word Databases or the [ v ] arrow symbol on the right side.
  5. Click the MySQL Databases button, which is next to the phpMyAdmin icon.
  6. Under Current Users, check the username of the privileged user connected to the database you are trying to access.
  7. After confirming the database name and username, and if you can’t remember the password, you may reset it and create a new one. To do this, click Change Password or the key symbol to the right.
  8. On the next page, below the Set MySQL User Password, fill out the Password fields.
  9. Click Change Password to save your new password.
    If you find it difficult to make a strong enough password for your email, you can let the system create one for you.
    Click the Password Generator button. In the pop-up box, copy the generated password and paste that in the Password fields.
    You can also choose to check I have copied this password in a safe place. Then, click Use Password. This will automatically copy and paste the generated password in the Password fields.

    Important Note: Make sure you have actually saved the generated password in a safe and easy to recall place.

Congratulations, you now know how to check your database configuration settings and reset your password.

Check if MySQL is active

Another possibility that you are unable to establish a connection to the database is if it is deactivated. To check if your database is active or not, you can use the following:

  • the phpinfo.php file
  • Telnet

With the phpinfo.php page

To access the phpinfo.php, follow the steps below:

  1. Open a web browser tab.
  2. Type the file's web address (url) in the browser address bar. Usually, it can be found in the public_html/www directory. The URL will be http://yourdomain.com/phpinfo.php. Simply replace the “yourdomain.com” with your own domain name.
  3. If you typed in the correct path, the page should load and display all information about the configuration of your server. To get the information on MySQL, simply scroll down to get to the MySQL data tables.
    By default, the tables will be arranged in alphabetical order.

If you don’t have a phpinfo.php page yet, you can create one in your File Manager. To know how to do this, click the link below:

With Telnet

To use Telnet to check if your MySQL database is activated, follow the steps below:

  1. With your Windows computer, access the Start menu.
  2. Next, go to Run, then type cmd to access command prompt.
    If you are using Mac, go to Search on the upper right corner of your screen, and type "terminal". Click on the top search result and that should launch the terminal window on your Mac.
  3. Once inside the command line interface or terminal window, type the following command:
                telnet yourdomain.com 3306
                
    Be sure to replace the "yourdomain.com" with your own domain name.
  4. Hit the Enter key on your keyboard. This will activate the command, test the port, and your computer will try to connect to your server through Telnet.
    If your MySQL database is activated, you will get a confirmation string that will start with a MySQL database version number.
    If your MySQL database is deactivated, you will receive the error message Could not open connection to the host.

Note: There is also the possibility that the likely causes of service unavailability are either a temporary high load on the server, or the service is being restarted. This should clear up within minutes.

Check MySQL database

Yet another reason you may be having problems with your database is because some files or sections may be corrupted. To find out of this is the case, you need to run a system check on your database. To do this, follow the steps below:

  1. Click on My Account at the top of the page.
  2. Select Hosting Manager from the drop-down menu.
  3. Enter your username and password, and click Log In.
  4. On the Home page, click the word Databases or the [ v ] arrow symbol on the right side.
  5. Click the MySQL Databases button, which is next to phpMyAdmin icon.
  6. Under Modify Databases, go to Check Database. Select the database you want to check, then click Check Database button to the right.
  7. The system will then run a script to check the database.
    If the system detects an error, it will say so in the results page and will even specify where the corrupted files or sections can be found.
    If the database has no problems, it will display gray box with list of sections with “OK” statuses and the phrase Check Complete in a green box at the bottom.

If the Check Database test returned some errors, you can try to resolve these by running “Repair Database”. To know how to do this, click the link below:

If you have a backup copy of your MySQL database, you may also restore your database to a previous version. To know how to do this, click the link below:

If you are still unable to resolve the issue after a time, please contact our 24/7 technical support.

If you want to know how to get started with Web Hosting, click here.

If you want to know how to access the Hosting Manager, click here.

If you want to know what to do if you have a database connection error with WordPress, click here.

Was this helpful? Yes No 41% of people found this helpful.