SuperAPI AI Directory

MySQL-AIops

MySQL-AIops is an open-source AI operations tool for MySQL 8.x and MariaDB 10.6+ database administrators (DBAs). It connects to databases via PyMySQL and reads information_schema / performance_schema, providing core capabilities such as slow query root cause analysis, InnoDB lock wait and deadlock chain analysis, replication lag root cause analysis, and table fragmentation analysis. It has a built-in governance framework: unified audit logging, token/runaway budget protection, reversible operation records, and risk level labels. The tool is offered in two forms: a CLI and an MCP server, with a total of 35 MCP tools (26 read, 9 write), and all calls record audit rows. Credentials are stored encrypted locally, write operations support dry-run and double confirmation, and reversible write operations record a reverse operation descriptor. The project uses the MIT license, is community-maintained, and is not affiliated with Oracle or the MariaDB Foundation.

Open website

About this tool

MySQL-AIops is the member of the AIops-tools family focused on MySQL / MariaDB DBA operations. It uses the MIT license, is community-maintained, and is not affiliated with Oracle Corporation or the MariaDB Foundation. It connects to MySQL 8.x or MariaDB 10.6+ servers via PyMySQL, reads information_schema and performance_schema, and has a built-in governance framework (unified audit logging, token/runaway budget protection, revocation token records, descriptive risk level labels). The server type (mysql or mariadb) is automatically detected from version(), and type-dependent statements are automatically branched (such as SHOW REPLICA STATUS and SHOW SLAVE STATUS).

The main capabilities include four flagship analyses: slow query root cause analysis (takes the worst events_statements_summary_by_digest entries from performance_schema, optionally with EXPLAIN FORMAT=JSON plans, and maps numeric values such as the no-index ratio, lock time share, scanned/sent rows ratio, temporary disk spill, call count, and plan access type to cited causes and concrete actions); InnoDB lock wait and deadlock chain root cause analysis (builds a wait tree from performance_schema.data_lock_waits or MariaDB's information_schema.innodb_lock_waits, identifies the root blocker, and parses the most recent deadlock from SHOW ENGINE INNODB STATUS); replication lag root cause analysis (maps replica IO/SQL thread status, Seconds_Behind_Source, and error fields to causes and actions); table fragmentation analysis (ranks tables by reclaimable data_free in information_schema.tables and gives OPTIMIZE TABLE candidates).

Usage: provides a CLI (mysql-aiops init, overview, server, activity, query, index, table, repl, analyze, remediate, secret, doctor, mcp) and an MCP server (mysql-aiops mcp or mysql-aiops-mcp), with a total of 35 tools (26 read, 9 write), and every tool goes through the built-in @governed_tool governance framework. Credentials are stored encrypted in ~/.mysql-aiops/secrets.enc (Fernet + scrypt) and unlocked via MYSQL_AIOPS_MASTER_PASSWORD or an interactive prompt. All state-changing CLI operations support --dry-run and require double confirmation; all write MCP tools accept dry_run for preview. Non-parameterizable identifiers (schema/table/index/column/variable names) undergo strict character set validation and backtick quoting, and all values use bound parameters.

Applicable scenarios: daily operations, performance diagnostics, lock troubleshooting, replication monitoring, and table maintenance for MySQL / MariaDB databases. Limitations: not applicable to PostgreSQL (use postgres-aiops instead), OT/industrial edge scenarios, or application schema migration/ORM management; the tool itself does not decide whether write operations are allowed—permissions are controlled by the connected database account; top_queries / slow_query_rca require performance_schema=ON, and the read account needs PROCESS, REPLICATION CLIENT, and SELECT privileges on performance_schema; replication analysis has not yet been verified against real replicas.