Select location & language
  • Österreich German
  • Australia English
  • België Dutch
  • Canada English
  • Schweiz German
  • Deutschland German
  • Eesti English
  • Ελλάδα English
  • España Spanish
  • France French
  • Hrvatska English
  • Italia English
  • Latvija English
  • Lietuva English
  • Nederland Dutch
  • Norge Norwegian
  • Polska Polish
  • Portugal Portuguese
  • Slovensko English
  • Suomi Finnish
  • Sverige Swedish
  • United Kingdom English
  • United States English
  • American Samoa English
  • Andorra English
  • Anguilla English
  • Antarctica English
  • Bermuda English
  • British Indian Ocean Territory English
  • British Virgin Islands English
  • Cayman Islands English
  • Christmas Island English
  • Città del Vaticano English
  • Cocos (Keeling) Islands English
  • Falkland Islands English
  • French Southern Territories English
  • Gibraltar English
  • Guadeloupe French
  • Guam English
  • Guernsey English
  • Guyane française French
  • Heard & McDonald Islands English
  • Ireland English
  • Isle of Man English
  • Jersey English
  • Liechtenstein German
  • Luxembourg French
  • Malta English
  • Martinique French
  • Mayotte English
  • Monaco French
  • Montserrat English
  • New Zealand English
  • Norfolk Island English
  • Northern Mariana Islands English
  • Pitcairn Islands English
  • Puerto Rico Spanish
  • Réunion English
  • San Marino English
  • Slovenija English
  • St. Barthélemy English
  • St. Helena English
  • St. Martin English
  • St. Pierre & Miquelon English
  • Svalbard & Jan Mayen English
  • Turks & Caicos Islands English
  • U.S. Outlying Islands English
  • U.S. Virgin Islands English
  • Åland Islands English
  • Κύπρος English
  • Црна Гора English
Shopping cart

How to Fix Error Establishing a Database Connection in WordPress

1 min read

“Error establishing a database connection” means WordPress cannot reach its database. It is a common error with a few clear causes. This guide explains how to diagnose and fix it.

What the error means #

WordPress stores your content in a MySQL database. If it cannot connect, usually because of wrong credentials, a database issue, or a server hiccup, it shows this error instead of your site.

Step 1: Check your database credentials #

Open wp-config.php and confirm the database name, username, password, and host (usually localhost) match what is in your hosting control panel. A recent migration or password change is the most common cause of a mismatch.

Step 2: Confirm the database user’s access #

  • In your control panel, make sure the database user is assigned to the database.
  • Confirm the user has the right privileges.

Step 3: Check the database itself #

Open phpMyAdmin and confirm the database exists and has tables. Occasionally a database can need repair, which WordPress can attempt if you enable repair mode.

Step 4: Rule out a server issue #

If credentials are correct and it still fails, the database server may be temporarily overloaded or down. Wait a few minutes and retry, and check whether other sites on the account are affected.

Troubleshooting summary #

  • After a migration: fix the credentials in wp-config.php.
  • Suddenly, no changes: likely a temporary server issue; retry shortly.
  • Corrupt database: try WordPress repair mode.

Need help? #

If the error persists, our support team can check the database and server for you over live chat.

What are your feelings

Your Account