Some links on this page are affiliate links. See full disclosure in the page footer.

Error Establishing a Database Connection: What It Means

“Error establishing a database connection” usually means WordPress cannot connect to the database it needs to load your website.

WordPress uses files for code, themes, plugins, and uploads. It uses a database for posts, pages, settings, users, menus, plugin data, and many other parts of the site. If WordPress cannot reach the database, the site may not load.

What the Error Usually Means

The error may happen when:

  • The database name is wrong
  • The database username is wrong
  • The database password is wrong
  • The database host is wrong
  • The database server is unavailable
  • The hosting account has reached a resource limit
  • The database is damaged
  • A migration changed files but not database settings
  • Disk space is full
  • The site was compromised

The page may show this error on the public site, the WordPress dashboard, or both.

Check Whether Anything Changed

Database connection errors often appear after a change.

Ask:

  • Was the site migrated?
  • Was wp-config.php edited?
  • Was a database password changed?
  • Was the hosting plan moved?
  • Was the domain pointed to a different server?
  • Was a backup restored?
  • Did the site run out of storage?
  • Did a security event happen?

The timeline helps separate a temporary server problem from a configuration issue.

The wp-config.php File

WordPress stores database connection details in a file called wp-config.php.

This file usually contains:

  • Database name
  • Database username
  • Database password
  • Database host

If any of these values do not match the database on the hosting account, WordPress cannot connect.

Do not edit this file casually. A single wrong character can keep the site offline. Before editing, take a backup or copy the current values somewhere safe.

Check the Database Itself

The database needs to exist and be reachable.

Check:

  • Does the database still exist?
  • Does the database user still exist?
  • Does the user have access to the database?
  • Has the password changed?
  • Is the database server running?
  • Is the hosting account out of resources?
  • Is disk space full?

If you do not know where to check these details, ask your hosting provider or developer. Guessing passwords or hostnames can create more confusion.

Migration Problems

This error is common after a website move.

It can happen if:

  • Files were copied but the database was not imported
  • The database was imported but wp-config.php still points to the old database
  • The database user was not created
  • The database password changed
  • The database host value is different on the new hosting
  • The site is pointing to the wrong server

After a migration, website files and database settings have to match the new hosting environment.

Temporary Hosting or Resource Issues

Sometimes the settings are correct, but the database server is temporarily unavailable or overloaded.

This may happen if:

  • The hosting environment has a temporary database issue
  • The site receives a traffic spike
  • A plugin makes heavy database queries
  • Disk space or memory limits are reached
  • Too many database connections are open

If the error comes and goes, resource usage or database availability may be involved.

Compromise or Corruption

A hacked site, damaged database table, failed update, or broken restore can also cause database trouble.

If the error appeared alongside strange redirects, unknown users, new files, or security warnings, treat it as a possible security issue and avoid deleting files before someone reviews the site.

What to Do First

  1. Save a screenshot of the error.
  2. Note when it started.
  3. Check whether the WordPress dashboard also fails.
  4. Review recent hosting, migration, password, or restore changes.
  5. Confirm database credentials in wp-config.php.
  6. Confirm the database exists and the user has access.
  7. Check hosting resource usage.
  8. Restore only if you have a reliable backup and know what may be lost.

If your WordPress site needs a dependable backup option before deeper troubleshooting, you can explore Website Backup through Tech Help Canada Hosting.

HelperX Bot

Not sure what to read next?

I can suggest related Tech Help Canada articles based on the topic you’re reading now.

 

Want a heads-up once a week whenever a new article drops?

Subscribe here

Leave a Comment

Open Table of Contents
Tweet
Share
Share
Pin
WhatsApp
Reddit
Email