WordPress

How to fix the error when establishing a connection to the database in WordPress

How-to-Fix-Error-Establishing-a-Database-Connection-in-WordPress

Mostly we get the error message on screen when establishing a connection with the database.

This message is quite explicit in itself. It simply indicates that it could not establish a connection to the database. This causes an error and may be due to several reasons.

How to identify the possible causes of the error when establishing a connection with the database?
Normally this error is caused by:

Incorrect information in wp-config.php

In this file, the connection data is stored. The constants are defined: DB_NAME, DB_USER, DB_PASSWORD and DB_HOST. This data can change between different environments when making a migration, or simply that someone changes the name of the bbdd, the user or the password. Check that the connection data is correct.

It surpassed the quota of space of BBDD

It could be the case that you have exceeded the quota of space of BBDD. If so, increase it or optimize the database from the control panel of your hosting. Check that you do not have tables created from plugins that you no longer use, limit the number of revisions. In the official repository, you can find several plugins that can help you in this task.

Host is down

Get in touch with your hosting provider. They will tell you if the server is down and they can give you a solution.

Suffer an attack

The cause may be an attack. It is advisable to use a security plugin such as Sucury or All In One WP Security & Firewall. You can also try online tools such as Sucuri SiteCheck, WP Doctor or WP Danger.

Fortunately, in most cases, it is an error that is easily solved. Simply look for the source of this error, find out why the connection to the database is not being made and check that the settings are correct.

Related posts

Enable Gutenberg Editor in Custom Post Types

WPITECH

40+ Best Free WordPress Themes for 2019

WPITECH

How To Hide or Disable Add To Cart Button In WooCommerce Store

WPITECH