How to Fix Error Establishing Database Connection in WordPress

How to Fix Error Establishing Database Connection in WordPress

How to Fix Error Establishing Database Connection in WordPress-: Whatever activity we perform on our WordPress website result increase in database. if your database is not optimized or corrupt an end-user may get an error of establishing a database connection. WordPress database stored in My SQL which need to be optimized on an equal interval of time. In this post, I will talk about how to fix error establishing a database connection.

Fix Error Establishing Database Connection In WordPress-:

WordPress database stored in MySQL and Php is the programming language to communicate with the server. Error establishing database connection means the connection between Server and website content is lost. Error establishing database connection means There could be many reasons for Error Establishing database connection which are as follow.

Your login credentials (username and password) may have been changed. Even if you didn’t make the change yourself, this could have happened somehow.

  • If you install a poorly coded plugin, your database may corrupt.
  • Your website may be experiencing a heavy traffic spike, which is beyond your server’s capacity.
  • Your WordPress web hosting may be at fault and the database is not functioning due to some problem at their end.

In this post, we will learn how to repair the WordPress Database using wp-config file. Locate your wp-config file on your hosting cPanel or using FileZilla FTP client under Public HTML folder. Take the Backup of your wp-config file and add the following code at the bottom of your wp-config file.

define('WP_ALLOW_REPAIR', true);

Now Go the following path in your web browser and replace with your website URL.

How to Fix Error Establishing Database Connection in WordPress

Now you will see two option, I would recommend you to choose “Repair and Optimize Database” because it is the best way to repair and optimize the database. This repair page can be accessed without the need to log in, so it creates a security issue. Immediately after the repair and optimization have finished, remove the line of code you added to the wp-config.php file.

Thanks for reading…“Pardon my grammar, English is not my native tongue.”

If you like my work, Please Share on Social Media! You can Follow WP knol on Facebook, Twitter, Pinterest and YouTube for latest updates. You may Subscribe to WP Knol Newsletter to get latest updates via Email. You May also Continue Reading my Recent Posts Which Might Interest You.

About Amar Patel 263 Articles
Hi, I am Amar Patel from India. Founder, Author and Administrator of I am a Simple Average Man who Loves life and Love living life.Professionally I am a Mechanical Engineer. Apart from my Job, I Love to write the things around WordPress WordPress CMS.