How To Fix Error Establishing Database Connection Issue In WordPress?


The “Error establishing database connection” issue in WordPress is a common error that can be caused by a number of different things, but it is usually relatively easy to fix.

  1. Check your database credentials: Make sure that the database username, password, and hostname entered in your wp-config.php file are correct. You can find this information in your WordPress hosting account control panel.
  2. Repair your database: WordPress has a built-in database repair tool that can fix minor database corruption. To use the tool, go to the WordPress dashboard and navigate to Tools > Repair Database.
  3. Check your file permissions: Make sure that the WordPress files and folders have the correct permissions. You can check the file permissions using your FTP client or through your hosting account control panel.
  4. Disable all plugins: If you have any plugins installed, disable them all and see if that fixes the error. If it does, then you can re-enable your plugins one by one to see which one is causing the problem.
  5. Increase the PHP memory limit: If you are using a shared hosting plan, your PHP memory limit may be too low. 


define(‘WP_MEMORY_LIMIT’, ‘256M’);

Use code with caution. Learn more

If you are still having trouble fixing the error, you can contact your WordPress hosting provider for assistance.

Here are some additional tips to help you avoid the “Error establishing database connection” issue:

  1. Use a strong password for your database user account of WordPress core and plugins up to date.
  2. Back up your WordPress database regularly.
  3. Use a caching plugin to reduce the load on your database.

Consider upgrading to a managed WordPress hosting plan, which can provide you with more reliable support and performance.

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x