When a beginner starts learning WordPress and develops sites on it, he or she surely encounters many problems. “Error establishing a database connection” is one of the basic errors which one can witness. Experienced WordPress developers don’t get scared with this error rather they enjoy fixing it. On the other hand, beginners don’t take this error maturely and get perplexed easily. Well, after looking for the causes of this error it can be easily fixed. In this post, I will dig a little deeper about this error and come up with the solution that could be implemented smoothly.
First of all, let’s give it an acronym for the term “Error Establishing Database Connection”: EEDC. In order to understand EEDC error, it’s very important to point out that WordPress CMS is built using PHP scripting language and MYSQL database. When we try to open a WordPress website by putting the URL in address bar and hitting enter then it’s the task of PHP to fetch all the required contents from the MYSQL database and display accordingly. However, media files such as images and videos are stored in wp-content folder (File Structure in WordPress). The MYSQL database contains all the crucial information which is needed to create the site. Now, when PHP is not able to connect with MYSQL database because of one or another reason then this EEDC message pops up on the screen. Which is, to put in simple term, PHP is conveying a message: “I couldn’t find the data that is required, so fix the error that I am flashing”?
The configuration of a WordPress website is written in wp-config.php. In this file we need to specify four things for proper connectivity of the site to database which are listed below.
Apart from this, if database user has not authorization to perform actions on the mentioned database then also EEDC error appears.
Each WordPress website is hosted on a server. If due to maintenance reasons or by any other reason your server is down then you need to talk to your server provider and ask him to fix the issue as it’s not something you can fix.
To find out whether EEDC error is a result of corrupted database or not we must check the wordpress backend i.e. www.site.com/wp-admin. If same error flashes on the screen then database is definitely corrupted. Yes, you read it right but, it can be repaired in three easy and simple steps.
Did you solve your EEDC error after reading this post? Please share your views in the comments.