How to Fix “Error Establishing A Database Connection” in WordPress
Surely, this is one of the first possibilities that you have considered to launch your web project.
The installation is easy to execute if you decide to host your website on a hosting in Spain as Webempresa.
- Install a clone of your site.
- Move your site to another location.
- Manual installation.
Sound familiar?
It is common that in this type of executions you will encounter some errors. Let’s see one of the most common ones that we will talk about in this section so that you can learn, without too much effort, to solve the error by connecting the WordPress database.
Database connection error in WordPress
One question we should ask ourselves about this database connection error is whether the information you use to connect is correct. This tends to be the most common problem in most cases and gives rise to this conflict.
Let’s see with an easy three-step process how we can solve this database connection error in WordPress.
Locate the wp-config.php file
From the WePanel of your hosting account, locate the File Manager Application. You can see this first guideline in the following image:
Verify connection data
When editing this file, locate the following data:
define('DB_NAME', 'cuenta_nombreBD'); define('DB_USER', 'cuenta_nombreUser'); define('DB_PASSWORD', 'claveUserBD'); define('DB_HOST', 'localhost');
– the database name DB_name_account,
– the user assigned to the database account_nameUser,
– the password of the user keyUserBD.
MySQL Database connection data
From the WePanel of your hosting account, locate the Database section and then MySQL Database.
In addition, you have the option to view the user’s privileges by clicking on the user name link, make sure he/she has all the privileges.
¿Do you still have a database connection error?
By executing this simple process, the database connection error should be resolved, however, if you are still having problems, then you can check what I suggest below:
If you have problems with your database server.
This case is rare, you can rule it out by installing a new WordPress website through the automatic installer or if you have more than one website on your account, and they all have the problem, then it could be a server problem.
In these circumstances, we recommend you consult with the hosting support where you host your WordPress.
If your database is corrupted.
In this other case you would have to re-export your database and import it again.
Another option that I propose you is that from your WePanel of your hosting account, enter in the section “Database > MySQL Database”, and try to correct the database, as you can see in the following image:
Conclusions
As you have seen, fixing the database connection error in WordPress is not that complicated.
If you want to avoid a headache, using the guidelines we have discussed will allow you to see your website published and in perfect condition for your users to browse it.