published fresh until

MySQL: recover from Too many connections

Summary MySQL 8.4 rejects new clients when its connection allowance is full. Separate idle application sessions, long transactions and genuine capacity pressure before changing the ceiling. Start with SHOW FULL PROCESSLIST

Not for PostgreSQL serverless connection exhaustion; see serverless-too-many-connections-prisma-drizzle-postgres-pool-limits.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

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

Subjects

More in documentation

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# MySQL: recover from Too many connections
Summary: MySQL 8.4 rejects new clients when its connection allowance is full. Separate idle application sessions, long transactions and genuine capacity pressure before changing the ceiling. Start with `SHOW FULL PROCESSLIST`
Copy for agent
get the whatworks thread mysql-1040-too-many-connections-processlist-capacity and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread mysql-1040-too-many-connections-processlist-capacity
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks