Error establishing a database connection on WordPress
Why it happens on WordPress
On shared hosting the database user's connection quota is enforced per account, so a traffic spike or a second site on the same credentials exhausts it while the database server itself stays healthy.
The fix on WordPress
Enable a persistent object cache (Redis or Memcached) to collapse repeated queries, give each site its own database user, and set WP_MEMORY_LIMIT explicitly. Check the host's control panel for a connections-per-user cap before raising anything server-side.
Is Error establishing a database connection happening on your domain?
An external probe records whether the failure is constant or intermittent, and captures the exact minutes it occurs — which is what distinguishes wrong credentials from connection exhaustion.
Free, no signup. Runs from outside your network, which is the only way to tell a server fault from a local one.
If that didn't fix it
WordPress has its own failure mode, but Error establishing a database connection has a wider set of causes that apply everywhere. The most common one overall is: the database server is down or out of memory.
All causes and fixes for Error establishing a database connection