Become Wordpress Professional - Your Ultimate Wordpress Guide

Friday, 8 March 2013

Solution for establishing database connection error

Database connection establishing error

Many wordpress users might face database connection error that could have been caused while installing wordpress, by removal of required configuration file or due to some other logical error. So what exactly does cause this weird error to popup?. Well, wordpress is a content management system that runs on web programming language PHP in collaboration with a powerful MYSQL database that stores not only the entire text information of the site but it works beyond that. Therefore it is necessary to create a linkage of wordpress core PHP files with MYSQL database so that both of them can communicate to run the platform successfully.

PHP files and MYSQL in wordpress : An example to understand things easily

We can simplify it by assuming wordpress as an airplane and assume the PHP files are the first wing of the airplane while MYSQL database is the second wing of the airplane. Now it is common sense that an airplane can never fly with one wing. Similarly wordpress can not run until both PHP files and MYSQL are both present and that they have a proper configuration for linkage to communicate efficiently, allowing wordpress application to run smoothly.

Fixing database connection error

Now that you have a grasp on how wordpress works technically, it would be much simpler to judge what area is exactly the faulty and is causing the weird error to popup. Here are the steps you should verify to fix this problem:

  1. Check to see if the "wp-config.php" file exists in the root of your wordpress installation.
  2. If it does not exist, you can simply upload "wp-config.php" file that you can find inside the wordpress installation package and follow up with the instructions. If you do not have wordpress installation files, you can download it by clicking here.
  3. If "wp-config.php" exists, open it up using a notepad and find the following lines of code and configure it as described in the following image:

If you are still not sure how to set the file up, you may follow up with our how to install wordpress guide in detail.
If you are not sure what your database name is, you can simply check it out from PHPmyAdmin or create a new database instantly.

Note: Make sure not to mess up with any code already inside the wp-config.php file and place the database name, username, and password with care without making any syntax error. Doing so will cause other problems too and will trigger more errors other than just database connectivity issue.

After making sure you have inserted the database name, username and password correctly, save the wp-config.php file and upload it to the root directory of your site. That would certainly fix the database connection error as we have provided the correct path to PHP files to communicate with database.


Post a Comment

Please Avoid Spamming. Comments will be moderated before they are published.