WordPress
WordPress database error: how to narrow the cause
“WordPress database error” is a family of symptoms rather than one failure. Start by preserving the exact message and time, then determine whether WordPress cannot connect at all or whether one specific query or table is failing.
Separate connection failures from query failures
An “error establishing a database connection” points toward connectivity, credentials, database service health, or capacity. A message naming a table or SQL statement means WordPress reached the database but a particular operation failed.
Check the environment before editing the database
Verify the database service is running, disk space is available, the configured host and credentials are correct, and the account has not hit connection or resource limits. Recent server, password, or migration changes are especially useful clues.
Use logs and backups before repair tools
Application, PHP, and database logs can show whether a plugin, upgrade, disk issue, or server error preceded the failure. Take a current backup when possible before running table repairs or making structural changes.
Fix the root cause, then verify writes
After service returns, test login, content updates, forms, orders, and scheduled work that writes to the database. A homepage loading from cache does not prove the database is healthy.