Home›Learn›MySQL 6: when it breaks
MySQL · Chapter 6

When MySQL breaks

Something is wrong right now. Where do I start?

Confirm what is really happening, find the cause, then fix the smallest thing that works. These playbooks follow that order.

Chapter 6 · When it breaks

Start from what you see

Each playbook starts from a symptom, confirms it read-only, names the likely causes in the order I see them, and only then suggests a fix with its risk. The same playbooks drive the DBA agent.

PlaybookToo many connectionsNew connections fail with "too many connections" (MySQL) or "sorry, too many clients already" (PostgreSQL), or the app's pool times out waiting for one. Often right after a deploy, a failover or a traffic spike.PlaybookCPU at 100%The database CPU is pinned and everything is slower. Often no single query looks slow on its own.PlaybookThe disk is filling upFree space is falling faster than the data is growing, or an alert fired at 85%.PlaybookA replica is far behindReads from replicas return old data, or the lag alert fired. A failover now would lose more, or take longer.PlaybookQueries waiting on locks, or timing outRequests hang, then fail with lock wait timeouts or deadlock errors. CPU may be low: things are waiting, not working.PlaybookOne query suddenly got slowA query that took milliseconds yesterday takes seconds today. The code did not change.PlaybookEverything is slow and the disk is busyRead latency is up across many queries. Disk reads per second climbed, and CPU waits on I/O.PlaybookOut of memory, or the server restartedThe database process was killed by the operating system, or restarted on its own. Clients saw connection errors.PlaybookWrites and commits are slowReads are fine, but inserts and updates take longer. Commit latency rose while CPU is low.PlaybookTables grow but rows do notTable size keeps rising while the row count is flat. Scans get slower over weeks.PlaybookInnoDB Cluster: lost quorum, or every member is downWrites hang or fail across the cluster. MySQL Shell reports the cluster has no quorum, or every member is OFFLINE after a power or network event.PlaybookInnoDB Cluster: a member is in ERROR, expelled, or slowing everyoneOne member shows ERROR, RECOVERING for a long time, or was expelled. Or writes on the primary slowed down because one member falls behind (flow control).PlaybookInnoDB Cluster: the database failed over, but the apps did notcluster.status() is OK with a new primary, but apps still fail writes or cannot connect.

When the binlog fills the disk

Writes start failing, then the database refuses writes entirely. Break the disk down by owner before touching anything. The binlog is usually the filler, and the first assumption is usually wrong: a dead replica does not hold binlogs back, because MySQL purges by time. Check three numbers before naming a cause: the retention value, the write rate, and the oldest file in SHOW BINARY LOGS. Retention times write rate larger than the disk, retention set to 0, auto-purge off, and a burst that outran purge all look the same from the application.

The fix is the purge, not the replica. Check every replica position with SHOW REPLICA STATUS, then free space with PURGE BINARY LOGS TO '<oldest file still needed by any replica>'. The BEFORE form, PURGE BINARY LOGS BEFORE '2026-11-01 00:00:00', frees everything older than a time instead. Never rm old binlog files by hand. Set binlog_expire_logs_seconds to a value your write rate and disk can actually hold, and alert at 70 percent, not 98 percent. A replica that still needs a file you purged fails with error 1236 and must be rebuilt from a backup, which is why positions come first.

Related MySQL stories: GitHub's failover with Orchestrator and its 1,200-host upgrade, and the moves to Vitess at Slack and Shopify. All are on the Stories page. How to host MySQL on-prem, on EC2, in Kubernetes, or managed is on the Cloud page.

Before you leave, check this

One command. It tells you how close the redo log is to stalling writes.

SHOW ENGINE INNODB STATUS\G -- read the LOG section: checkpoint age vs capacity
← Chapter 5: Running it as a DBREYou finished the MySQL trackBack to chapter 1Or pick another database in the Learn menu.
Part 1 of 4 · Learn · 56 pagesAll pages

How do databases actually work? From one row on disk to transactions: the words you need, PostgreSQL, MySQL and MongoDB from the files up, then Redis, Cassandra and vector search, side by side, and the query and concurrency traps.

Start 1: the basicsStart 2: ten conceptsStart 3: how a query travelsStart 4: napkin mathThe courseShort videosPostgreSQL 1: why PostgreSQLPostgreSQL 2: how it stores your dataPostgreSQL 3: what happens on every writePostgreSQL 4: high availability with PatroniPostgreSQL 5: running it as a DBREPostgreSQL 6: when it breaksPostgreSQL on Kubernetes: CloudNativePGMySQL 1: why MySQLMySQL 2: how it stores your dataMySQL 3: what happens on every writeMySQL 4: high availability with InnoDB ClusterMySQL 5: running it as a DBREMySQL 6: when it breaksMySQL failover with OrchestratorMySQL on Kubernetes: the Percona operatorsMongoDB 1: why MongoDBMongoDB 2: how it stores your dataMongoDB 3: what happens on every writeMongoDB 4: high availability with replica setsMongoDB 5: running it as a DBREMongoDB 6: when it breaksMongoDB on Kubernetes: the Percona operatorB-tree and LSM treeRedis 1: why RedisRedis 2: how it stores your dataRedis 3: high availabilityRedis 4: running it as a DBRERedis 5: when it breaksCassandra 1: why CassandraCassandra 2: how it stores your dataCassandra 3: high availabilityCassandra 4: running it as a DBRECassandra 5: when it breaksVector databases 1: why vector searchVector databases 2: how it stores your dataVector databases 3: high availabilityVector databases 4: running it as a DBREVector databases 5: when it breaksDatabase familiesEngines side by sideQueries that look fine and are notLost updates and write skewMany servers 1: keep a copy runningMany servers 2: who is the leaderMany servers 3: CAP as settingsMany servers 4: unique IDsMany servers 5: split the dataMany servers 6: across servicesMany servers 7: a thousand databasesStaff path, zero to architect