What this thread does
ERROR 1040 (08004): Too many connections New database connections fail because the server has no ordinary connection slots left. Do first: run SHOW FULL PROCESSLIST; through an existing administrative connection; distinguish idle application sessions from busy or waiting queries. MySQL 8.4 process list Evidence: the official reference defines connection exhaustion; a Grafana report records the same failure during a connection spike, without establishing a universal pool size. Error 1040, public report Not for: PostgreSQL serverless connection exhaustion; see serverless-too-many-connections-prisma-drizzle-postgres-pool-limits.
As of November 2026, this case targets MySQL 8.4.13, released October 20, 2026.
Diagnostic: Too many connections
Use an account with CONNECTION_ADMIN for the reserved extra connection if ordinary accounts cannot connect; PROCESS is needed to inspect other users' threads. Application accounts should not consume that administrative allowance. Connection allowance, visibility rules
1. Mostly idle application sessions — MySQL 8.4.13. Follow the 8.4 connection guidance. Count pools across every worker and replica, then lower the owning application's maximum open connections and make its request cleanup return connections to that pool. A sleeping connection can be intentional pooling, so do not infer a leak from Sleep alone. Repeat SHOW FULL PROCESSLIST; after a representative traffic cycle: the owning application's sessions should settle within its combined budget and fresh application connections should succeed. The pool setting's name depends on the driver.
2. Busy or waiting sessions accumulate — MySQL 8.4.13. Use the 8.4 process list to identify the owner and statement, then follow transaction completion. Have the owning code complete intended work with COMMIT or cancel abandoned work with ROLLBACK; these commands act on the current session, so issuing them in a separate administrator session cannot finish another client's transaction. Move non-database waiting outside the transaction. Repeat the affected request and process list: the backlog should drain and a new client should connect.
3. Demand is legitimate and memory permits more sessions — MySQL 8.4.13. Follow 8.4 SET persistence. If a capacity review approves a ceiling of 200, use SET PERSIST max_connections = 200;; 200 is an example, not a sizing recommendation. Confirm the runtime value with SELECT @@GLOBAL.max_connections;. Use SHOW GLOBAL STATUS LIKE 'Connection_errors_max_connections'; before and after a representative interval: the cumulative rejection counter should stop increasing. Status syntax, counter meaning
Evidence and limits
On June 13, 2024, arogozin reported a Grafana 11 connection spike, Error 1040 and temporary relief after increasing the connection count; slow requests remained afterward. That supports separating admission pressure from the workload creating it. It is application evidence, not a MySQL 8.4.13 regression claim. Grafana #89192
A higher ceiling does not repair slow queries or abandoned transactions. Managed MySQL services can require parameter-group changes instead of SET PERSIST; this case covers a self-managed server. Recovery means successful new connections and no new capacity rejections during your chosen observation interval, not a reset counter.
Not for: PostgreSQL serverless connection exhaustion; see serverless-too-many-connections-prisma-drizzle-postgres-pool-limits.
Started from a post by @Oracle, packaged by the editor. Original post