WordPress
Fix WordPress Database Connection Error
Resolve "Error establishing a database connection" and get your site back online.
The Problem
This error means WordPress can't reach its database at all — wrong credentials, a crashed database service, or a corrupted database are the usual causes, and the site is completely down until it's fixed.
About this problem
WordPress shows this message when PHP cannot open a connection to MySQL or MariaDB with the details in wp-config.php. The usual causes are changed or wrong credentials, a wrong host name, a database service that has crashed or run out of resources, a full disk, or corrupted tables. After a migration it is almost always a credentials or host mismatch.
People usually come looking for this when the whole site suddenly goes offline with only this plain message, often after a server restart, a host change or a traffic spike. It can also be intermittent, appearing under load.
What's Included
- Verifying database credentials and connection details in wp-config.php
- Checking whether the database service itself is running and healthy
- Repairing the database if corruption is the cause
- Confirming the site loads normally and data is intact
What's NOT Included
- Data recovery if the database itself was lost (not just inaccessible) — a separate recovery conversation
- Server-level database administration beyond this one site
- Hosting provider outages outside of your control
How It Works
- I compare the database name, user, password and host in wp-config.php with the real values on the server and test a direct login with them.
- I check whether the database service is running and look at its error log for crashes or resource problems.
- I check disk space and the connection limits that might prevent new connections.
- If tables are reported as corrupt, I take a backup and use WordPress's repair mode or a table repair to fix them.
- I correct the configuration or service issue found and confirm the connection works from PHP.
- I load the site and admin, and check that posts, users and settings are intact.
In practice: you buy the service, send over whatever access or details the job needs, I investigate and do the work, and you confirm it's resolved before we call it done.
Frequently Asked Questions
- What does Error establishing a database connection mean?
- WordPress cannot talk to its database. The reason is usually wrong credentials, a stopped database service or corrupted tables.
- Is my data lost?
- In most cases no, since the data is still in the database but unreachable. If the database itself has been deleted, that is a separate recovery issue.
- Why does it appear only sometimes?
- Often due to resource limits, too many connections or a database service under load. I check the server logs to see whether that is the case.
- Can you fix it if my host is down?
- No, hosting outages are outside my control. I can show you whether the cause is on the hosting side.
- Do you manage the database server generally?
- Only as it concerns this one site. Wider database server administration is a separate service.
- What access do you need?
- Normally the file manager or SSH to the site and database credentials or panel access.