WordPress Database Connection Error: What to Check
Error establishing a database connection means WordPressWordPress is free software for building and editing a website in your browser. It is written in PHP, so it builds each page when someone visits. cannot reach its database.
More about this
Common causes are incorrect settings in wp-config.phpwp-config.php is the file containing basic settings for a WordPress installation, including its database connection., a stopped database server or a hostingWeb hosting is the service that keeps your website's files on a computer that is always online, so visitors can open your site at any time. problem.
What the message means
WordPress stores pages, posts and settings in the database. Without a connection, it cannot load them. The public site and administration area may show different messages, but both need the database connection.
Common causes
Which PHP version does your site report?
We read only what your site already sends in public: the headers and the top of the homepage. No scan, no login.
The database name, username, password or hostname may be wrong after a migration or password change. The database server may be unavailable or overloaded, the database damaged, or the hosting account at a resource limit.
How to check safely
Back up whatever you can still access. Open wp-config.php through the host's file manager and compare the connection settings with the hosting panel. Never publish this file or paste passwords into a chat or forum.
What you can try
Correct settings that do not match. Ask whether the database server is running and whether other sites are affected. If the settings are correct but the error remains, ask for a database integrity check or recovery.
Change passwords in the hosting panel and update the matching value in wp-config.php.
After a PHP version change
The new configuration may lack a database extension such as mysqli. Ask the host to check that required extensions are enabled. Check supported PHPPHP is a programming language that builds your web pages on the computer that hosts your site, just before they reach the visitor. WordPress runs on it. versions before choosing a version.
Preventing another failure
Keep credentials in a password manager and update the site configuration immediately after a password change. Check the hostname after moving servers. Keep database backups outside the server and test recovery.
Watch storage warnings: a full disk can stop the database.
When to get help
If recovery fails or data may be missing, get help before making further changes. A person replies within 1 business day. Emergency repair starts from $425, excluding VAT.