Too Many Database Connections on a Website: Find the Limit Before Raising It
A database connection failure can make a busy website look entirely offline, but the page alone rarely names the cause. If a log actually says “Too many connections,” identify which limit was reached and what occupied the connections at that time. This worksheet keeps the diagnosis tied to evidence, so a capacity change does not hide a stuck application path.
Boletolibre editorial team
Published
Updated
1. Confirm the exact database error
MySQL reports “Too many connections” when clients cannot connect because available server connections are already in use. The global max_connections variable controls that server-wide ceiling. A separate max_user_connections or account MAX_USER_CONNECTIONS rule can cap one database account. Ask the host which message and limit apply; a site owner may not have permission to read server-wide settings.[1][2][4]
Do not infer saturation from a generic “Error establishing a database connection” page. WordPress documents several other causes, including incorrect connection settings and a host-side outage or quota. Capture the exact application or database log message with its timestamp before changing passwords, increasing limits or restarting a server.[6]
2. Compare the limit with evidence from the same window
Record the database engine/version, affected account, time zone, first failure and recovery time. If the operator can provide MySQL metrics, compare max_connections with Threads_connected and a change in Connection_errors_max_connections across the incident. Threads_connected is a current snapshot; Connection_errors_max_connections counts refusals at the global ceiling. Max_used_connections is a high-water mark, not a live count; its timestamp helps place the peak. A reading taken hours later cannot reconstruct the incident by itself.[3][2]
| Signal | What it can establish | Limit of the evidence |
|---|---|---|
| Exact “Too many connections” log line | A refused MySQL connection occurred | Does not name the application route using the slots |
| Threads_connected beside max_connections | Current global occupancy relative to the ceiling | A quiet later snapshot can miss a short peak |
| Change in Connection_errors_max_connections | New refusals at the global ceiling | A total without before/after values cannot date the event |
| Account connection-limit message | One user may have hit its own cap | Server-wide headroom can still remain |
For example, an operator might report `max_connections` 100, `Threads_connected` 100 near the error, and `Connection_errors_max_connections` rising from 8 to 13 in that same window. That supports a global-limit event, but does not identify which website route held the slots. In a separate incident, a global snapshot of 40/100 plus a confirmed account cap of 20/20 and an account-limit error points toward the account ceiling instead. These are illustrative readings, not target values. Ask for server `Uptime` and any restart or status reset between the before/after samples; do not calculate a counter delta across different lifetimes.[3][2][4]
If the host only exposes a control-panel alert, ask whether it is a server-wide connection limit, a per-account concurrent limit, or a different resource. Do not substitute a CPU, entry-process or disk chart for a database-connection counter.[2][4]
3. Find what occupied the connections
Place connection counts beside traffic, the affected routes, application worker count, scheduled jobs and recent deploys. Was a legitimate on-sale surge enough to use the existing ceiling? Did a new route open more connections per request? Did old sessions linger after a background job? These are hypotheses to test, not conclusions from a single spike.
An authorized operator can inspect MySQL process information for account, state and duration. Without the PROCESS privilege a user generally sees only their own threads. Process-list output may include SQL text and sensitive values, so share counts and redacted patterns rather than a raw export. If access is unavailable on shared hosting, ask the provider for a sanitized breakdown of active versus idle sessions for your account during the failing window.[5]
Separate a global limit from a per-account limit. MySQL account resource controls can restrict simultaneous connections even when max_connections still has room. The remedy may be an application connection pattern or a plan-specific account cap; the global setting alone does not answer it.[4]
4. Change the smallest verified cause
If a release left connections open or starts too many concurrent workers, have the application owner correct connection lifecycle and concurrency, then observe the next peak. If expensive requests keep sessions busy, investigate those routes and queries. If legitimate demand repeatedly reaches a documented cap after those checks, discuss capacity with the host. Increasing max_connections is a server-operator decision with resource implications and may be unavailable on shared hosting.[1][2]
During a live registration or purchase flow, protect the user outcome. Before asking someone to resubmit, check whether their earlier action created a record. A database error shown after a request does not by itself prove no write occurred. Avoid a blind restart or a blanket increase that erases useful evidence and lets the same failure return.
5. Verify the visitor path and the next comparable peak
After one change, repeat a safe public-page and non-payment form check through the normal website path. Confirm the expected record appears once. Compare connection occupancy, refusal-counter delta and visitor errors over a similar traffic window. If the counter still rises, the incident is not resolved even if a quiet-hour test passes.[3]
Write down who owns the application fix, who can change the database limit, and the threshold for escalation. A useful support request includes redacted error text, time zone, affected path, counter snapshots and the last deployment or job change; it excludes database credentials, raw SQL values and customer submissions.[5]
6. Copy this incident worksheet
Make one copy per incident. Fill unknown fields with “not available”; never invent a metric. The rows keep a page symptom, database evidence and corrective action on the same timeline.
| Field | Record |
|---|---|
| Incident window | Start/end in one time zone; site and affected path |
| Visitor impact | Page or safe form action; exact observed result |
| Exact database message | Sanitized wording and source log; no credentials |
| Limit scope | Global max_connections, account limit, or unconfirmed |
| Snapshots | Threads_connected; max_connections; Max_used_connections/time |
| Refusal delta | Connection_errors_max_connections before and after |
| Workload clue | Traffic, route, workers, scheduled job or release at that time |
| Counter continuity | Server Uptime or known restart/status reset between samples |
| Change and proof | Owner; one change; next comparable peak; visitor result |
Sources and further reading
- MySQL 8.4: Too many connectionsOracle MySQL · Accessed
- MySQL 8.4: Server system variablesOracle MySQL · Accessed
- MySQL 8.4: Server status variablesOracle MySQL · Accessed
- MySQL 8.4: Setting account resource limitsOracle MySQL · Accessed
- MySQL 8.4: Accessing the process listOracle MySQL · Accessed
- Common WordPress errorsWordPress Developer Resources · Accessed