How to Fix the Error Establishing a Database Connection in WordPress

If you are WordPress user or during the visiting websites, you have must seen error like this

Error Establishing Database Connection

When we see this kind of error frustrated situation, Become Word Press beginner

its Big problem because you’re facing error without doing anything

then don’t worry

How to Fix it?

In this Post, I’m going to share Ultimate  Guide

How to Fix WordPress the error establishing a database connection

it takes only a few steps

Alert: Before applying this method, make sure you have backup of databases

Here are Reasons Why Do You Get Errors:

Let’s take a look at Why we get this errors

Here’s much reason why you get this kind of errors

  1. It could be your database login credentials  are wrong
  2. or have been changed
  3. due to Database Server is unresponsive
  4. or database corrupt

but the maturity of time error occur due to server error

Let’s take a look how to troubleshooting this error

Does Same Problem occur on Admin Page(/WP-admin) as well:

Make sure this mistake happen on front-end(front-page/page) of website or  back-end (admin panel/dashboard) of website

If you facing same error on front-end and also back-end

it may be error something different from front-end

Maybe you get the error on (wp-admin) page like this  “One or more database tables are unavailable.” or maybe you get error ” Error Establishing a Database Connection”

Don’t worry ! it is also easy to fix

Then your database  need to fix or repair

just adding some following lines of code in your wp-config.php (you can found out this wp-config file by using the panel of your website/server)

 

define('WP_ALLOW_REPAIR',true);

 with the help of this line of code WordPress allow us to repair and fix the database issues

 

Once you done this job, go to below link for viewing setting

http://www.yoursite.com/wp-admin/maint/repair.php

 

Let’s Take Look on WP-CONFIG FILE:

Wp-Config.php is one of the most important files in WordPress installation.

Because this file contains a lot of important information about WordPress installation

  • Database Name
  • Database Username
  • Database Host
  • Data based Password
define('DB_NAME', 'database-name');
define('DB_USER', 'database-username');
define('DB_PASSWORD', 'database-password');
define('DB_HOST', 'localhost');

if by mistake  remove or change anything inside the wp-config file your WordPress website may be shut down and appear some same error message on screen  “Error Establishing a Database Connection”Error establishing a database connection

for the fix, this error, check your wp-config.php file and check

  • DB_NAME
  • DB_USERNAME
  • DB_PASSWORD
  • DB_HOST

check these things from your DATABASE

Just go to MySQL or PHPMyAdmin in your Cpanel

Hope you Enjoy this tutorial about Error Establishing a Database Connection If you like this method hit click on Share button

If you have any query, drop the comment below: