Troubleshooting common database errors

Find out how to diagnose the most common cases of database errors

Last updated 8th October 2021

Objective

Your database usage may result in anomalies on your website or error messages in the OVHcloud Control Panel, as well as on the phpMyAdmin interface.

Find out how to troubleshoot database errors with OVHcloud Web Hosting plans.

OVHcloud is providing you with services for which you are responsible, with regard to their configuration and management. You are therefore responsible for ensuring they function correctly.

This guide is designed to assist you in common tasks as much as possible. Nevertheless, we recommend that you contact a specialist service provider and/or discuss the issue with our community on if you have difficulties or doubts. You can find more information in the Go further section of this guide.

Requirements

Instructions

"Error establishing a database connection"

Check ongoing incidents

First, check on https://web-cloud.status-ovhcloud.com/ whether your data centre, hosting cluster is affected by an incident on the OVHcloud infrastructure.

You can find these details in your OVHcloud Control Panel, in the Web Cloud section:

  • To find your Web Hosting plan's data centre and filer (file server), open Hosting plans and select the plan concerned. The information is available in the General information tab.
  • To find the cluster of servers on which your hosting is located, click on the FTP-SSH tab. The cluster identifier is part of the name of your FTP server.

Verify login credentials for your database

Log in to the file storage space of your Web Hosting plan by FTP and find your website’s configuration file (for example, a WordPress website will have a wp-config.php file located in the folder containing your website).

The name and content of the file relevant for database connection information depends on the CMS used for the website. This does not lie in the scope of responsibility of OVHcloud.

We recommend that you contact the publisher of the CMS concerned or a specialised service provider if necessary. We will not be able to assist you with this.

Then check the exact match between the login details for phpMyAdmin and the login details for your website’s configuration file.

If necessary, change your database password.

Example for WordPress

If your website displays an "Error establishing a database connection" message and your hosting cluster is not affected by an incident, log in to the FTP storage space of your hosting and open the directory containing your website (by default, this is the "www" folder).

If this is a WordPress site, open the file "wp-config.php".

define('DB_NAME', 'my_database');

/** MySQL database username */
define('DB_USER', 'my_user');

/** MySQL database password */
define('DB_PASSWORD', 'my_password');

/** MySQL hostname */
define('DB_HOST', 'my_server.mysql.db:port');

In your OVHcloud Control Panel, open the Hosting plans section and click on the Databases tab. Check the correspondence between the elements displayed and those in the file wp-config.php:

  • my_database must match what is noted as Database name;
  • my_user must match what is noted as User name;
  • my_password corresponds to your database password;
  • my_server.mysql.db must match the Server address.

If you are unable to restore access to your website as a result of these changes, back up your database then restore it to an earlier date from your OVHcloud Control Panel.

Contact a specialised service provider if necessary. We will not be able to assist you with this.

You have exceeded the authorised quota

You have received an email notification stating that the amount of data on your database exceeds the authorised limit. Your database has therefore been switched to read-only mode. This will prevent your website from being modified.

mail_overquota

There are three ways you can unblock your database in this situation.

Method 1: Upgrade your subscription

If you have a Personal or Professional Web Hosting plan, we recommend that you switch to the high-performance offer. This subscription change will increase the size of your database which will automatically reopen it. This method is the simplest and does not require any particular technical expertise.

The increase of the size of your database may be linked to a malfunction in your website's internal code.

In this case, changing your Web Hosting plan would be ineffective, as your database will continue to fill up.

If you notice a sudden increase in the size of your database, or if you have a "blog" type site that normally does not use much data, we advise you to contact a specialised service provider as soon as possible. We will not be able to provide you with support on this matter.

To upgrade your subscription, log in to your OVHcloud Control Panel and open Hosting plans in the left-hand menu. Select the relevant service and click on the ... button in the Solution section of the right-hand info box, then select Upgrade.

If you are already subscribing to a Performance offer, refer to method 2.

Method 2: Migrate your data to a larger database

You can also migrate your data to a new database:

Method 3: Delete unnecessary data

Once you have made a database backup, log in to your phpMyAdmin interface to delete any unnecessary data using the Drop, Delete and Truncate commands.

Then update the data usage from the Databases tab of the relevant service. Click on the ... button next to the database concerned, then select Recalculate the quota.

This operation requires advanced technical knowledge. We recommend contacting a specialised service provider if you need to use this method. We will not be able to assist you with this.

Method 4: Optimise your database

To optimise your database, follow the instructions in our guide "Configuring your database server". Then update the data usage from the Databases tab of the relevant service. Click on the ... button next to the database concerned, then select Recalculate the quota.

If the advice on how to optimise your database is not sufficient to unblock the access to your website, we recommend you to contact our community or OVHcloud partners. We will not be able to assist you in this regard.

Database import errors

User access denied to database

"#1044 - Access denied for user to database"

This error message means that the database you are trying to import contains elements that are not authorised on the OVHcloud shared infrastructure.

First make sure that your database is empty from the Databases tab of the relevant service. Click on the ... button next to the database concerned, then select Recalculate the quota. (If you need to save the existing data first, follow the backup instructions, then delete the data and relaunch the import operation.)

You can also tick the Empty the current database box just before launching the import:

database-import-empty

If necessary, contact our user community or OVHcloud partners for more information. We will not be able to assist you in correcting this issue.

You cannot have a "trigger" in your database’s import script on OVHcloud shared hosting servers.

The following query is also not allowed:

CREATE DATABASE IF NOT EXISTS `Database-Name` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci; 

Use this this line instead:

USE `Database-Name`;

Replace Database-Name with the name of the database as displayed in your OVHcloud Control Panel.

Unable to access phpMyAdmin

"Access denied for user"

"mysqli::real_connect(): (HY000/1045): Access denied for user"

This error message may appear when connecting to your database by phpMyAdmin. It indicates that the credentials entered are incorrect.

access_denied_for_user

In this situation, check the credentials entered and change your database password if necessary.

"Too many connections"

"mysqli_real_connect(): (HY000/1040): Too many connections"

The maximum number of active connections for databases delivered with a shared hosting (Start SQL) is 30.

A "Too many connections" error when connecting to phpMyAdmin appears, if this maximum number of connections is exceeded.

In this situation, you will need to optimise your databases in order to reduce the number of active connections.

If you have any questions about the changes you need to make in order to reduce the number of active connections to your database, please contact our community or OVHcloud partners. We will not be able to assist you in this regard.

"Name or service not known"

"mysqli::real_connect(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known"

This error message appears when connecting to phpMyAdmin if the server name entered is incorrect.

name_or_service_not_known

Check the server name for the relevant database service in your OVHcloud Control Panel.

If the database you would like to connect to appears in the Databases tab of the Hosting plans section of your OVHcloud Control Panel, the name to enter is in the Server address column.

Go further

Resolving the most common 1-click module errors

For specialised services (SEO, development, etc.), contact OVHcloud partners.

Join our community of users on https://community.ovh.com/en/


Did you find this guide useful?

Please feel free to give any suggestions in order to improve this documentation.

Whether your feedback is about images, content, or structure, please share it, so that we can improve it together.

Your support requests will not be processed via this form. To do this, please use the "Create a ticket" form.

Thank you. Your feedback has been received.


These guides might also interest you...

OVHcloud Community

Access your community space. Ask questions, search for information, post content, and interact with other OVHcloud Community members.

Discuss with the OVHcloud community