How to fix “Error establishing a database connection” Print

  • 0

Common causes

  • Wrong database username or password
  • Database does not exist
  • Corrupted tables
  • MySQL server overloaded

Step 1 — Check wp-config.php

DB_NAME
DB_USER
DB_PASSWORD
DB_HOST = localhost

Step 2 — Test the database connection

In phpMyAdmin, try logging in with the same DB user. If login fails, credentials are wrong.

Step 3 — Repair the database

  1. Open phpMyAdmin
  2. Select the database
  3. Check all tables
  4. Choose Repair table

Step 4 — Restart plugins

Some caching or security plugins can break DB connections.

Step 5 — Check disk limits

If your plan reached disk quota, MySQL cannot write data.

Step 6 — Switch PHP Version

Incompatible PHP versions may break DB drivers.


Was this answer helpful?

« Back