Skip to content

MySQL and MariaDB

This page holds what is particular to MySQL and MariaDB databases. How database monitoring works for every engine — setup, collector pools, privacy, the tabs, alarms and billing — is on Database monitoring. The layer pages (Storage and growth, Schema-change history, Query analytics, Advisor, Slow and error logs and Cloud metrics for RDS and Aurora) keep their MySQL and MariaDB passages under a MySQL and MariaDB heading.

Pick where the database runs first. Each provider has its own setup page:

Provider Engines Page
Self-managed on Amazon EC2 — on a monitored server itself, or on another server in the same VPC MySQL 5.7, 8.0, 8.4, 9.7 · MariaDB 10.11, 11.4, 11.8, 12.3 Self-managed on EC2
Amazon RDS for MySQL MySQL 5.7, 8.0, 8.4 Amazon RDS and Aurora
Amazon Aurora MySQL Aurora MySQL 3.x and 8.4 (certified) · 2.x (supported) Amazon RDS and Aurora
Amazon RDS for MariaDB MariaDB 10.6, 10.11, 11.4, 11.8, 12.3 (supported) Amazon RDS and Aurora

Other providers — Google Cloud SQL, Azure, DigitalOcean, Akamai, Vultr, OVHcloud, Scaleway, UpCloud, Aiven, Oracle MySQL HeatWave and any other MySQL-compatible endpoint — cannot be set up. PlanetScale is not supported: it gives no SQL-level monitoring access.

The general table is on Database monitoring. For MySQL and MariaDB, by name:

Collected Never collected
Connections against max_connections, threads running Passwords or keys: WatchTower15 stores only where your collectors find them
Queries by command, row operations, slow queries, temporary tables View definitions
Buffer pool hit ratio, row lock waits, deadlocks, network bytes Anything over a connection WatchTower15 opens: it opens none
Replica state and lag Your data: no table of yours is read; sizes come from InnoDB’s statistics table mysql.innodb_table_stats and its tablespace and file views
Schema structure — tables, columns, indexes, views and routines — as keyed hashes with column types in clear Column defaults, comments and expressions, routine bodies, ENUM and SET members: only that one changed
Statement statistics from performance_schema — calls, time, rows examined and sent, index use and errors per normalised statement — as keyed hashes The statement history tables, EXPLAIN plans, wait events and locks
Advisor facts: tables without a primary key, redundant and unused indexes, row versions and the server certificate’s dates, from InnoDB’s catalogue views (the names of tables, indexes and their columns), mysql.innodb_index_stats and performance_schema’s index-usage counts Password hashes: the optional account grant names six columns of mysql.user, and the password hash is not one of them
With the optional account grant only: account names and their authentication settings (plugin, TLS requirement, password expiry and lock state), as keyed hashes
The slow query and error logs: each slow statement’s times and rows under a keyed hash, each error’s time, severity, code and subsystem A statement’s values, the client’s host and address, an error’s continuation lines (dumps, stack traces), mysql.slow_log and the general query log

Rates are worked out on the collector, per second, from the server’s own counters; a counter reset (a restart, or FLUSH STATUS) is detected and never shows as a spike.

The collector opens a read-only session and runs a fixed list of statements per engine version. The grant script grants nothing more.

Now shows Connections, as a share of max_connections with N of the maximum beside it; Threads running; Queries per second; Buffer pool hit ratio; and Monitoring coverage. An example of the coverage gauge: a self-managed database with every grant but performance_schema off, whose slow and error logs are both read, collects L1 to L4 and the logs, none of L5 and half of L6 (the advisor’s statement checks need performance_schema), and L7 does not apply: 5.5 of 7 layers, 79%.

Step 4 generates a script for your engine, version, connection and authentication. Run it on the database as an administrator. It creates the user wt15_monitor with:

  • REQUIRE SSL on every TCP connection but loopback, and at most three connections;
  • a host part that is your collectors’ subnet, never one server’s address — a replacement server gets a new one;
  • tier A (PROCESS, REPLICATION CLIENT; on MariaDB PROCESS, SLAVE MONITOR, BINLOG MONITOR, and on RDS for MariaDB PROCESS, BINLOG MONITOR): health, workload, the storage sizes, and the advisor’s checks on tables and indexes;
  • tier C (SELECT on InnoDB’s statistics tables): row estimates, the sizes of tables kept in a shared tablespace, and the size of each unused index the advisor reports;
  • tier D (REFERENCES, SHOW VIEW, plus SHOW_ROUTINE on MySQL 8 and 9 and SHOW CREATE ROUTINE on MariaDB 11.3 and later): the full schema-change history — exact column types, views, non-InnoDB tables and, with either, routines;
  • tier B (SELECT on performance_schema.events_statements_summary_by_digest): query analytics, which also needs performance_schema on. Its SELECT on performance_schema.table_io_waits_summary_by_index_usage gives the advisor its unused indexes. The script’s other performance_schema grants are not read yet: grant them now, so you grant once;
  • the optional account grant (SELECT on six named columns of mysql.user, never a password hash), last and marked optional: the advisor’s account check. Run it only if you want that check.

View definitions are out of scope: no grant in the script reveals them, and Verify reports them as not available (expected). A user holding more than monitoring needs — a global SELECT, a write privilege, SUPER or ALL — is flagged Over-privileged on the database’s page.

Every 5 minutes the agent on the active collector reads MySQL’s statement summary from performance_schema and sends the leading statements’ figures, each under a keyed hash. It needs performance_schema on — on RDS and Aurora, a custom parameter group and a reboot — and tier B. The advisor reads InnoDB’s catalogue, index usage and, with the optional account grant, six columns of mysql.user. See Query analytics and Advisor.

The alarms of Database monitoring read, for MySQL and MariaDB:

Alarm Wording
Database connections high Open connections against max_connections
Database slow queries high Statements slower than long_query_time
Database deadlocks InnoDB reports a deadlock

MySQL 5.7 does not count deadlocks where the agent can read them, so the deadlock alarm never fires on 5.7. A database that is not a replica, every Aurora cluster and an RDS for MariaDB read replica (see Aurora and replication) has no replication series, so the replication alarms never fire there.