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

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.

Workflow

What to review

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.

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