Your WordPress site shows one line of text instead of your homepage: "Error establishing a database connection". Every page is down at once. It looks alarming, but it usually means one thing: WordPress cannot reach the database that holds your content. Here is why that happens, the safe checks to do first, and when to get help.
What the error means
WordPress keeps your pages, posts, users and settings in a database, separate from the website files. On every visit it logs in to that database to fetch the content. When it cannot log in or cannot reach the database at all, it shows this one line instead of your site. Your content is usually still there; WordPress just cannot get to it.
The usual causes
- Wrong database details. The database name, user, password or host in
wp-config.phpno longer match, often after a password change or a move to new hosting. - The database server is down or overloaded. Common on busy shared hosting, or when bot traffic floods the site.
- A damaged database table. A failed update or a crash can leave a table that WordPress cannot read.
- The hosting account is limited or suspended. If the host has restricted the account, the database goes with it. See what to do about a suspended account.
Safe checks to do first
- Back up before you touch anything. Download the site files and export the database from your hosting panel if it opens.
- Ask the host if the database server is up. If it is their outage, there is nothing to fix on your side.
- Compare the details in
wp-config.phpwith the database name and user shown in your hosting panel. A mismatch is the most common cause. - Do not reinstall WordPress over the top or delete the database to "start fresh". That is how a fixable error becomes lost content.
When to get help
If the details match and the host says the server is fine, the database itself may be damaged, or something else (including a compromise) may be at play. Repairing tables and checking for malicious changes is careful work, and a wrong step can make it worse. That is the point to bring in someone who does it regularly.
Once the site is back, check the rest of it: outdated plugins and weak passwords are behind many WordPress failures. Read how to secure a WordPress site and run the free website security check.
Common questions
What does "Error establishing a database connection" mean?
WordPress cannot reach the database that stores your pages, posts and settings. The files are there, but without the database it has nothing to show.
What causes a WordPress database connection error?
The usual causes are wrong database details in wp-config.php after a password change or move, the database server being down or overloaded, a damaged database table, or the hosting account being limited or suspended.
Have I lost my website content?
Usually not. The error means WordPress cannot connect, not that the content is gone. Take a backup of the files and database before changing anything, and do not reinstall WordPress over the top.
Services this guide relates to
Database error on your site right now?
Message us your web address. We will find the cause and get your pages back without risking your content.
Message us on WhatsAppOr message +263 77 690 2542 on WhatsApp.
Donovan Mudarikwa
Founder, Vanorika Technologies
Security-focused software engineer and penetration tester based in Harare, working with businesses across Zimbabwe and beyond. Founder-led, so you deal directly with the person doing the work.