WordPress “Error Establishing a Database Connection” Updated on February 23, 2022 by Scott Mitchell 1 Minutes, 56 Seconds to Read While the “Error Establishing a Database Connection” is a fairly common error, troubleshooting it can take a few different routes. This article will explain the error and go over the different causes and fixes. What is the “Error Establishing a Database Connection” error? This error means that your WordPress script either cannot locate the database, or is being refused the ability to connect to the database. What causes this error? This error can occur due to a few different causes, each one is described along with recommended solution. Incorrect connection parameters By far the most common, having incorrect connection credentials will cause the error. These credentials are located in the wp-config.php file found in the root folder for your WordPress installation. There are three credentials: database name, database user, and password. Make sure these match the information located in your cPanel. If you know the current database user password, you can reset it. If you do not know it, you will not be able to view the current password, so you will need to delete and then recreate the database user, giving it the password found in the wp-config.php file. If this is the issue, then the problem should be solved and the site should display normally Corrupted database tables If you have confirmed the credentials are correct and still get the error, the issue could be caused by corrupted database tables. Database tables can be checked and repaired from within the cPanel. Follow the instructions from our article below to perform the repair. How to Check and Repair a Database Too many concurrent database connections The error can also occur if there are too many connections to your database at once. Currently, the default limit for our servers is 30 connections at once. If this is your issue, you can certainly curb it by enabling caching plugins on your website. This will limit the overall number of database interactions your WordPress site performs. We have several articles to assist you with this. These are listed below. Optimizing WordPress with W3 Total Cache plugin Optimizing WordPress with WP Super Cache Plugin Additionally, there can be other causes for extraneous database interaction. These can be prevented by logging out of WordPress admin dashboard when not in use, disabling the WordPress autosave, and limiting or disabling WordPress revisions. Share this Article Related Articles How to Fix the “550 No Such User Here” Email Error Email Error – Mailbox Quota Exceeded Resolving DNS_PROBE_FINISHED_NXDOMAIN Errors How to Fix the Allowed Memory Size Exhausted Error How to Set a Custom 404 Page Using .htaccess MySQL 1064 Error: You have an error in your SQL syntax Chrome error: ERR_TOO_MANY_REDIRECTS Create a 503 Status Code for your Site I get a 404 error when I access cPanel Why is my Website Down?