MySQL Collector
MySQL collector script
Each inspection starts with a bash collector that runs on the target DB host. The script is zero-dependency, writes plain text, and is safe to run in production.
Or with curl
curl -O https://dbaclaw.com/collector/mysql.sh chmod +x mysql.sh
Requirements
- MySQL 5.6+ / 5.7 / 8.0(含 MariaDB)
bash4+ ·mysql客户端- 账号权限:
SELECT、SHOW DATABASES、PROCESS、REPLICATION CLIENT - 无需 sudo / root(除非要采集 OS 层 sysctl)
- 输出文本为 UTF-8 纯文本,单实例约 100-800 KB
Run it
./mysqlHealthCheckV3.0.sh \ --user dba --password '***' \ --host 127.0.0.1 --port 3306 \ --output-dir ./out # 每个实例跑一次。一主多从:在每个节点都执行一遍, # 把所有 out/MySQLHealthCheck_*.txt 一起上传。
Output
输出文件名格式:
MySQLHealthCheck_<IP>_<YYYYMMDDHHMM>.txt
例:MySQLHealthCheck_10.0.31.2_202606051430.txt。脚本会把所有结果写到 --output-dir。