Home›Learn›MySQL 5: running it as a DBRE
MySQL · Chapter 5

Running MySQL as a DBRE

What do I watch, which settings matter, and where do I look first?

The other half of the job: the signals I watch, the logs I read, the parameters that decide most outcomes, and the commands that show the truth on a live server.

Chapter 5 · Running it

What I watch on every MySQL server

The signals I put on a dashboard and alert on, and why each one matters.

Latency and errorswhat users feelp99 within target
Connectionsthreads in usealert at 80% of max
History list lengthold transactions block purgealert past 1 million
Replicationlag, or group member stateevery member ONLINE
Buffer poolhit rate and dirty pagesreads from disk flat
Redo and binlogwrite rate, retentionbinlogs fit the disk
Disk and backupsfree space, last restore testrestore never tested

Example dashboard: the thresholds are starting points I would tune per system, and the colors are made up for the picture.

SignalWhy I watch itWhere it comes from
Query latency and errorsThe numbers users feel; everything else explains them.performance_schema.events_statements_summary_by_digest
ConnectionsEach one is a thread; near max_connections new requests fail.Threads_connected, Threads_running
History list lengthLong transactions stop purge; undo grows and reads slow down.INNODB_METRICS trx_rseg_history_len
Replication or group stateA failover loses what a replica did not have.SHOW REPLICA STATUS, replication_group_members
Buffer poolWhen the working set stops fitting, reads go to disk.Innodb_buffer_pool_reads vs read requests
Disk, binlogs and backupsBinlogs fill disks; a backup counts only after a tested restore.The OS, binlog_expire_logs_seconds, your backup tool

Run the checks on your own server with the health check.

Every log file a DBA needs to know

Same idea as PostgreSQL: exact names, one job per log, one check per incident. The rule is written once on the PostgreSQL page. This table adds the operational logs a DBA reads first: server, error, slow.

LogExact file nameWhere it sits (on-prem)What it doesWhat to check in it
MySQL
Redo log
#ib_redo0 · #ib_redo31#innodb_redo/ in the datadir (before 8.0.30: ib_logfile0/1 in the datadir root)Physical record of page changes. Replayed at startup to rebuild dirty pages after a crash.Checkpoint age in SHOW ENGINE INNODB STATUS (LOG section). Age near capacity means write stalls are coming.
MySQL
Binary log
mysql-bin.000001, .000002, …Datadir (path set by log_bin)Logical record of every committed change. Replicas replay it. It is the second half of point-in-time recovery.SHOW BINARY LOGS. Check total size and the oldest file. Retention must exceed the longest replica outage.
MySQL
Error + slow logs
<hostname>.err · *-slow.logDatadir / /var/log/mysql/Error log: startup, crashes, warnings. Slow log: statements over long_query_time, with rows examined.Error log at the incident start. Slow log digested (pt-query-digest), ranked by total time, not by count.

The parameters DBAs actually touch during outages

Same three outage rules as PostgreSQL: Safe live lever, Planned change, Do not touch. What each one means is written once on the PostgreSQL page.

MySQL · InnoDB Outage parameters

ParameterWhat it doesDuring an outage
innodb_buffer_pool_sizeSize of the page cache. The single most important MySQL setting. Typically 70 to 80% of RAM on a dedicated server.Planned change. It is resizable online in 8.0 (SET GLOBAL), but resizing under load is slow and competes with the workload. Verify headroom first. Watch Innodb_buffer_pool_resize_status.
innodb_redo_log_capacityTotal redo log size (8.0.30 and later). It bounds checkpoint age headroom.Safe live lever (dynamic). Use it when checkpoint age is pinned near capacity and writes are stalling. Raise it, then confirm age falls.
max_connectionsCap on concurrent connections. Each thread costs memory.Short bridge only. It is dynamic, so a modest raise can stop "too many connections" errors while you fix the cause. The cause is almost always missing pooling (ProxySQL) or leaked connections. A big raise converts a connection incident into a memory incident.
innodb_flush_log_at_trx_commitThe durability dial. 1 means redo fsynced at every commit (safe). 2 means written to the OS, fsynced about once a second. 0 means about once a second entirely.Do not relax it mid-outage to buy speed, unless the business explicitly accepts losing up to about 1 s of commits per crash. You would be trading tonight's latency incident for a future data-loss incident.
-- check SHOW VARIABLES LIKE 'innodb_buffer_pool_size'; SHOW VARIABLES LIKE 'innodb_redo_log_capacity'; SHOW VARIABLES LIKE 'innodb_flush_log_at_trx_commit'; SHOW GLOBAL STATUS LIKE 'Threads_connected'; -- the safe lever (8.0.30+): raise redo capacity live SET GLOBAL innodb_redo_log_capacity = 8589934592; -- 8 GB
See it yourself · copy-paste commands

Open a real database and check every claim on this page

Same rule as PostgreSQL: every mechanism above is observable on a running server in under two minutes. The full version is on the PostgreSQL page.

Run it locally: docker-compose-mysql.yml starts MySQL 8.4 on port 3306 with a shop database. docker compose -f docker-compose-mysql.yml up -d, then run the commands below against it.

MySQL · mysql client + shell
-- where is everything?
SHOW VARIABLES LIKE 'datadir';
SHOW VARIABLES LIKE 'innodb_buffer_pool_size';
$ ls /var/lib/mysql/shop
-- → users.ibd, orders.ibd, …

-- the binary log
SHOW BINARY LOGS;
SHOW BINLOG EVENTS IN 'mysql-bin.000001';
$ mysqlbinlog mysql-bin.000001 | less

-- redo log position + undo backlog
SHOW ENGINE INNODB STATUS\G
-- replica state and lag
SHOW REPLICA STATUS\G
Next · chapter 6When it breaksPlaybooks, from the symptom to the fix← Chapter 4: High availability
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