Troubleshooting common database errors
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
- an OVHcloud Web Hosting plan
- an OVHcloud database service: Start SQL or Web Cloud Databases
OVHcloud Control Panel Access
- Direct link: Hosting plans
- Navigation path:
Web Cloud>Hosting plans> Select your web hosting plan
Instructions
"Error establishing a database connection"
Check ongoing incidents
First, check on the Web Cloud Status page whether your datacentre, your web hosting cluster, your Web Cloud Databases server, or your database is not 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, select
Hosting plans, then the relevant web hosting. You will find this information in theGeneral Informationtab. - To find the cluster of servers and filer (file server) of your web hosting, refer to this guide.
- To retrieve the name of your Web Cloud Databases server, click on
Web Cloud Databasesin the left-hand menu, then on the relevant service. You can find the information concerned under the headingHost namein theSQLpart of theGeneral informationtab. - To find the server on which your included or additional database ordered via your web hosting is located, refer to this guide.
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".
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.
There are three ways you can unblock your database in this situation.
Method 1: Upgrade your subscription
If you have a Starter or Personal 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:
- Order a larger database service if necessary, then create the new database;
- Duplicate the content of the old database to the new database or perform an export of your data, then import your data in the new database;
- Integrate the credentials of the new database into the configuration file of your site.
If you have a Performance Web Hosting plan, you can also activate a free Web Cloud Databases service.
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.
RAM overflows (Web Cloud Databases only)
The following message in the Web Cloud Databases section of your OVHcloud Control Panel indicates that your Web Cloud Databases server has consumed too much resources on the OVHcloud infrastructure:
In this situation, you can increase the amount of RAM available from the Web Cloud Databases section of your OVHcloud Control Panel. In the General information tab, click on the ... in the RAM section.
To increase the amount of RAM, the database needs to be a standalone service and not one of those included with a Performance web hosting plan. If you want to increase the amount of RAM of a database included in the Performance offers, you first need to detach it.
To detach the database, log in to your OVHcloud Control Panel and select Web Cloud. Click Hosting plans, then choose the web hosting plan that has the database activated.
In the Configuration box, click the ... button to the right of Web Cloud Databases, then click the Detach button.
You can also optimise your database by following the instructions of our guide "Configuring your database server".
If you experience any difficulties in decreasing the use of resources on your database server, please contact our community of users or OVHcloud partners. We will not be able to assist you with this.
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:
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. In this situation, import your database to a Web Cloud Databases server.
The following query is also not allowed:
Use this line instead:
Replace Database-Name with the name of the database as displayed in your OVHcloud Control Panel.
"MySQL server has gone away"
"404 ERROR MySQL server has gone away"
This error message appears when importing a database on a Web Cloud Databases server. I most cases, it is caused by the quantity of data to be imported being too large or by non-optimised SQL queries in the import script.
To resolve this issue, you can use the following methods:
-
Increase the amount of RAM: go to the Web Cloud Databases server concerned in the
Databasessection of your OVHcloud Control Panel. Then click on the...button in theRAMsection and selectChange the amount of RAM. -
Split your database in order to import it through multiple operations instead of one. (For any questions on the necessary steps, contact our community or OVHcloud partners. We will not be able to assist you with this.)
-
Optimise your database, then repeat the export/import operations.
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.
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.
This number increases to 200 for the Web Cloud Databases service. (This setting can be modified in the Configuration section of your database service.)
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.
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.
If you want to connect to a database on a Web Cloud Databases server, the server name can be retrieved from the tab General information, in the box Login information under SQL and labelled as Host name.
Unable to connect to a Cloud Databases database
Having a Web Cloud Databases server allows you to connect to your databases from your computer or a server outside of the OVHcloud infrastructure.
If this connection is not possible, first check that you have authorized your public IP address connected to the database server.
If this operation has been carried out, contact your ISP or the OVHcloud partners. We will not be able to assist you in this situation.
Go further
Getting started with Web Cloud Databases
Resolving the most common 1-click module errors
For specialised services (SEO, development, etc.), contact OVHcloud partners.
Join our community of users.