Skip to content

wp_db_connection_failed

Severity: Critical Signal: db_connection_failed — WordPress cannot connect to MySQL

What this signal means

WordPress failed to establish a connection to the MySQL database. Requests that triggered this are showing visitors the "Error establishing a database connection" screen.

What surprise this prevents

A complete site outage persisting unnoticed — every visitor seeing an error screen while no one on the team is aware.

Why it matters

This is a complete site outage. No pages can be served. Every visitor sees an error until the database connection is restored.

Investigate

View entity alerts in Logystera →

Check:

  • Is the error ongoing or was it a brief blip? Look at how many db_connection_failed signals fired and over what time window.
  • Did it coincide with high traffic (http.request spike)?
  • Did any db_connection_limit signals also fire? That indicates the MySQL connection pool was exhausted.

Immediate:

  1. Check if the site is currently down. Open the site in a browser or run: bash curl -I https://yoursite.com

  2. Verify MySQL is running (if you have server access): bash systemctl status mysql # or service mysqld status If it is stopped: systemctl start mysql

  3. Check database credentials in wp-config.php: php define( 'DB_HOST', 'localhost' ); define( 'DB_USER', 'db_username' ); define( 'DB_PASSWORD', 'db_password' ); define( 'DB_NAME', 'db_name' ); Confirm these match your actual database credentials. On managed hosting, the host may have changed after a migration.

  4. Check MySQL connection limits: sql SHOW VARIABLES LIKE 'max_connections'; SHOW STATUS LIKE 'Threads_connected'; If Threads_connected is near max_connections, you are hitting the limit.

  5. On shared hosting: Contact your host. Database outages on shared hosting are often infrastructure-level and outside your control.

  6. Enable persistent connections if you frequently hit limits: php define( 'DB_HOST', 'localhost:p' ); // 'p:' prefix enables persistent connections

When to safely ignore

A single transient connection failure during a brief database restart or maintenance window is expected. If the signal fires once and the site recovers within minutes, no further action is required beyond confirming recovery.

Signal reference

{
  "event_type": "db_connection_failed",
  "payload": {
    "error": "Can't connect to MySQL server on 'localhost' (111)",
    "query_hash": "a1b2c3d4"
  }
}