This error means WordPress could not complete the database connection it needs. Check service availability and the intended connection settings without exposing credentials or creating a new empty database over the existing site.
IN THIS ARTICLE
01 Establish the scope and recent change
Record when the error began and whether it followed a migration, password change, restore or hosting incident. Check whether other applications on the same service also have database problems. A temporary database service issue requires a different response from a mistyped credential in one installation.
Preserve the existing configuration and avoid editing several values at once. The website's files and database remain valuable even when WordPress cannot connect.
02 Review the connection safely
- Confirm the correct WordPress root and inspect the database settings in its
wp-config.phpthrough an authorised private method. - Compare the database name, username and host with the values assigned to that service.
- Check that the database exists and that the intended user has the required privileges.
- If a password was changed, coordinate the application configuration with the actual database-user credential rather than guessing.
- Review server or database logs for availability, connection-limit or authentication errors.
03 Example: check database connectivity without changing data
Where authorised WP-CLI is available, this small SQL request uses the credentials loaded from the specified installation. It checks whether the configured database connection can execute a read, while returning only the database identifier and a test value.
wp --path='/home/ACCOUNT/sites/example.com' db query \
'SELECT DATABASE() AS database_name, 1 AS connected;'
Compare the database name with the intended site before accepting success. A working command-line connection does not prove the web PHP process has the same configuration or connectivity. If the command fails, retain the sanitised error category and time rather than resetting passwords repeatedly or creating an empty replacement database.
Expected result: You can distinguish a connection failure from a wrong-site or web-runtime problem using a minimal read. The existing posts, users and settings remain intact, and any correction is verified through both the public website and administration area.
Which shortcuts can make a database-connection failure worse?
Do not run the WordPress installer to solve a connection error, create a blank database with a convenient name, or import an old backup without a recovery plan. Those actions can conceal the original site and overwrite newer content.
A table-repair action is relevant only when evidence identifies a table problem and the database engine supports the chosen repair method. It is not a generic fix for an unreachable server or wrong password.
04 Verify the correction
After one targeted change, open the public site and administration area. Confirm the expected posts, users and settings are present; connecting successfully to the wrong database can produce a working but incorrect site.
Test writes through a controlled draft or the relevant application workflow, then remove the test. Check fresh logs for recurring connection errors under normal load.
05 Escalate with useful evidence
Provide the domain, timing, recent changes and sanitised error details. Do not paste wp-config.php, passwords or full database connection strings into a public message. Support can inspect the assigned service through an appropriate route.
If the failure is intermittent, record several timestamps and concurrent workload clues. Repeatedly resetting the database password will not fix resource exhaustion or an unstable connection and may break other applications sharing the same user. Keep the recovery focused on the verified cause and preserve current business data throughout the investigation.