Database Error

"Error establishing a database connection" — fixed.

The actual reasons your site can't talk to its database, and how to fix each one.

This error means exactly what it says: WordPress can't reach your MySQL database. The whole site goes down because every page is generated from database queries. It's a five-minute fix when you know which of the five common causes you're looking at — and a stressful all-day saga when you don't.

Walk through these in order. If none apply, it's almost certainly your host's MySQL server — and worth getting eyes on it fast.

What you get

1. Verify wp-config credentials

DB_NAME, DB_USER, DB_PASSWORD, DB_HOST — match against hosting panel. 60% of cases stop here.

2. Test database server

From hosting panel, check MySQL is running. Many shared hosts pause DBs during maintenance.

3. Repair the database

WP_ALLOW_REPAIR flag + /wp-admin/maint/repair.php fixes most corruption automatically.

4. Check connection limits

Shared hosts throttle. SHOW STATUS LIKE 'Threads_connected' tells you if you're at the cap.

5. Reset DB user password

Wrong password from a stealth host change is more common than you'd think. Reset in hosting panel, update wp-config.

6. Restore from backup or migrate

If the DB is truly broken, restore from your last backup — or migrate to better hosting permanently.

Get a free quote

Tell me about your project.

A few quick questions and I'll come back with a tailored quote — usually within one working day.

Step 1

What service do you need?

Book a call

Free 30-minute consultation

Walk through your project, get honest advice, leave with a clear plan. No pressure, no waffle.

FAQs

Frequently asked questions