How to fix "Error establishing a database connection" in WordPress

This message means WordPress cannot reach its database. It looks scary, but it is usually fixed quickly. The most common causes are wrong login details, a changed database password, or a full disk.

Steps

If your cPanel uses the Jupiter theme

  1. Check you are not over your disk space. Open Files > Disk Usage. If you are at your limit, free some space.
  2. Open Databases > Manage My Databases and confirm your site's database still exists in the Current Databases list.
  3. Open Files > File Manager, go to your site's folder, and open the file wp-config.php. Choose Edit.
  4. Compare the values for DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST with your database details. The name and user include your account prefix.
  5. If you are not sure of the password, go to Databases > Manage My Databases, set a new password for the database user, and enter the same new password in wp-config.php.
  6. Click Save Changes, then reload your site.

If your cPanel uses the Meridian theme

  1. Check you are not over your disk space. Click Files, then the Disk Usage tab, or check Resource Usage on the Dashboard. If you are at your limit, free some space.
  2. Click Databases and confirm your site's database still exists. Click Manage if you need to check its users.
  3. Click Files, open the File Manager tab, go to your site's folder, and open the file wp-config.php. Choose Edit from the More menu.
  4. Compare the values for DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST with your database details. The name and user often include your account prefix.
  5. If you are not sure of the password, open the database in the Databases hub, set a new password for the user, and enter the same new password in wp-config.php. Save the password, because Meridian will not show it again.
  6. Save the file, then reload your site.

Tips and troubleshooting

  • Make a copy of wp-config.php before editing it.
  • Check that the user is added to the database with All Privileges in Manage My Databases.
  • If the database shows a problem, use Check Database and Repair Database on the same page. If it still fails, contact support.
  • A sudden outage that you did not cause may be a server problem, not a settings problem. Contact support.
  • Editing wp-config.php is delicate. A mistyped quote or missing semicolon will break your site. If you are not comfortable, ask us to help.

Need help? Contact Barrett IT Support at support@barrettit.com or call 888.374.4632.

  • 0 istifadəçi bunu faydalı hesab edir
Bu cavab sizə kömək etdi?

Uyğun məqalələr

Managing WordPress with WP Toolkit

WP Toolkit is a tool in cPanel that helps you look after WordPress websites. From one screen you...

How to install WordPress with WP Toolkit

WordPress is a popular tool for building websites. If your hosting plan includes WP Toolkit, you...

How to update WordPress, plugins, and themes

Most WordPress break-ins happen through old, out-of-date software. Keeping WordPress, plugins,...

How to back up your WordPress site

A backup is a copy of your site that you can restore if something goes wrong, such as a failed...

How to fix a WordPress white screen or "critical error"

A blank white page or a message saying there has been a critical error usually means a plugin,...