Problem

Error Establishing a Database Connection

Work through the WordPress database connection error by checking credentials, database availability, host configuration, and recent migrations without editing data blindly.

Problem, cause, fix, verify

Problem

WordPress cannot connect to the configured database server with the current settings.

Audience

Administrators seeing the WordPress database connection error on public or admin pages.

First check

Separate credential problems from database-service problems before changing configuration.

Verify

When WooCommerce, memberships, or forms are active, verify recent orders and submissions after recovery. Connection fixes should not silently switch the site to an older database snapshot.

Editorial trust

Published
Updated
Content type
Problems
Review editorial policy

Symptom

WordPress cannot connect to the configured database server with the current settings.

For: Administrators seeing the WordPress database connection error on public or admin pages.

Diagnosis

What to check before changing the site

Quick Diagnosis

Separate credential problems from database-service problems before changing configuration.

What Not To Do

Do not run repair SQL or change passwords until you know which connection detail failed.

Migration Clues

After a migration, compare database name, user, password, host, table prefix, and DNS timing. A copied file can point production at the old database or staging at the live database.

Business Data Check

When WooCommerce, memberships, or forms are active, verify recent orders and submissions after recovery. Connection fixes should not silently switch the site to an older database snapshot.

WordPress ErrorsSeverity: HighLast reviewed: 2026-09-16

Diagnosis

Symptoms, causes, checks, and fixes

Symptoms

  • The site displays Error establishing a database connection.
  • wp-admin may show the same error.
  • The issue often follows a migration, password change, outage, or host maintenance.

Most Common Causes

  • Incorrect database credentials.
  • Database server outage.
  • Changed database host.
  • Corrupt or unavailable database service.

How To Confirm The Cause

  • Check whether hosting reports a database incident.
  • Compare wp-config.php database constants against the hosting control panel.
  • Confirm other sites on the same account are not failing similarly.

Fixes

  • Correct database name, user, password, or host only when verified.
  • Ask hosting to restart or inspect the database service.
  • Rollback a migration if the connection details changed unexpectedly.

How To Verify The Fix

  • Reload the homepage and wp-admin.
  • Confirm error logs no longer report connection failures.
  • Check a dynamic page that reads posts or orders.

When To Contact Support

Contact hosting support when credentials are correct but the database host rejects connections or the service is down.

References

Official references