There is no need to introduce the error which states ‘error establishing a database connection in WordPress’. All of us will be getting this error and if the same problem occurs which you are working on your WordPress website, then you can fix this easily in less time. Just follow this complete process and you can avoid the problem and here are some solutions which you can follow and need not just bother about this problem at any time.
Reasons for this Error:
There might be a lot of reasons which you do not understand when the error states couldn’t connected to database. The list of the reasons include wrong login credentials or even when these details are changed you get the same error. When the database server is not responding, you will be facing the same problem. But most of the people agree that this error is mainly because of the server problem.
Does the problem occur for /wp-admin/ as well?
Check whether you are getting the same error in the front end and as well in the back end of the website. If the same error is shown at both ends, then you can skip this step. On the other hand if you get an error stating that ‘the database tables has to repaired’ then its time for you to repair the database.
Doing this is very easy and you just have to include the line
After adding this check with the settings here:
You can now check out the corrupted database without logging in. All you need to do is just ensure that you are removing this from the wp-config.php.
Why to Check the WP-Config file
If the same problem persists, then all that you need to is to check the WP-Config file which is important. Here you will be including the details of the database to connect it with the WordPress. Every time you chance the database password or the root password, one should change this file also. So make sure to check the wp-config.php whether this is same or not.
How to Check your Web Host (MySQL Server):
The experts often say that you get this error stating ‘Error establishing database connection’ especially when you are having problems with the server. It is when the server can’t handle the load, or when there is lot of traffic, then these situations will be faced. In this scenario, you have to know from the host provider whether the My SQL server is responding or not.
If you just want to know whether this server is responding or not by yourself then you can check for other sites whether they are working or not. When you are not able to find out whether the sites which you have opened are on the same server, then go to cpanel. Here you can connect the database with the phpMyAdmin and then find out how the things are working.
If this is getting connected to database, it is time for you to check for the user’s permission to the database. Here you have to properly place the username and password, it is by using these credentials, if the user gets connected, then he has permission and you need to check for other aspects.
All the below described solutions are provided by others but before you think of trying them, ensure that you are having proper backup for the database.
- When you get the same error even after repairing the data base. You have check for the URL of the site. For this you need to go to the phpMyAdmin and here you can replace the existing URL to the actual one.
- There are even who have successfully connected to the testconnection.php with the wp-config.php. But here one should change the wp-config.php user to the root ones. By doing this, the database started working and so they have again changed it to the data base user.
- One can even try by removing the contents of the plugins that are active in the wp_options table. Make changes to the recently edited ones. This will fix the problem.
- While others have just loaded the fresh copy of the URL and this didn’t show up with any sort of problems.
All these are the simple and useful solutions which are helpful to solve the problem. You can try these and if you have found something interesting and easy choices to fix this error. Do inform us with your helpful comments to everyone.
Reegan is a renowned WordPress developer by profession and currently working with WordPress Development Projects. In case, your looking for any WP Website then it is better to Hire PSD to WordPress Developer who can serve you the desire Services