database-mysql

Inspect MySQL schemas, run read-only queries, and diagnose replication and lock issues.

656|82|Updated Jan 20, 2026
One-click install
npx skills add https://github.com/incidentfox/incidentfox --skill database-mysql
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-mysql
Source: https://github.com/incidentfox/incidentfox/tree/main/sre-agent/.claude/skills/database-mysql
Command: npx skills add https://github.com/incidentfox/incidentfox --skill database-mysql

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires mysql-connector-python, and includes scripts (resource) components.

What problem does it solve?

Investigating MySQL or MariaDB incidents requires jumping between ad-hoc SQL commands to understand schemas, find slow queries, and check replication health. This Skill provides a structured, schema-first workflow with safe read-only scripts so you can diagnose database problems quickly without risking data modification.

Core Features & Use Cases

  • Schema Discovery: List all tables with size and engine stats, then describe columns, indexes, and foreign keys before writing queries.
  • Safe Query Execution: Run read-only SQL (SELECT, SHOW, EXPLAIN, DESCRIBE) with automatic row limits and built-in blocking of DML/DDL statements.
  • Health Diagnostics: Inspect the processlist for long-running queries, check InnoDB engine status for deadlocks and lock waits, and monitor replication lag with a computed health status.
  • Use Case: During an incident where the app reports slow database responses, run show_processlist.py to find long-running queries, then get_table_locks.py to identify lock contention blocking transactions.

Quick Start

Ask the agent to list the tables in the MySQL database and check for any long-running queries or lock contention.

Frequently Asked Questions about database-mysql

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I investigate slow MySQL queries during an incident?

Start with show_processlist.py --full to find active and long-running queries, then run show_engine_status.py to check InnoDB lock waits and recent deadlocks, and finish with get_table_locks.py to identify which transactions are blocking others.

How do I check MySQL replication lag from the command line?

Run show_replica_status.py, which executes SHOW REPLICA STATUS (or SHOW SLAVE STATUS on older versions) and reports Seconds_Behind_Master along with a computed health status of healthy, lagging, severely_lagging, or broken.

Can I run INSERT or UPDATE statements with this MySQL query tool?

No. The execute_query.py script only allows read-only statements (SELECT, SHOW, EXPLAIN, DESCRIBE, WITH) and rejects DML/DDL as well as multi-statement queries to prevent data modification.

Does this work with both MySQL 8 and older MySQL versions?

Yes. The replication script tries the MySQL 8.0+ SHOW REPLICA STATUS syntax first and falls back to SHOW SLAVE STATUS, and the lock inspection handles both information_schema and performance_schema sources.

Why does get_table_locks.py return no lock data?

Lock inspection requires performance_schema to be enabled on the server. If it is disabled, the script returns a message indicating performance_schema is not enabled instead of lock details.