cli-execution-mastery
它能做什么
这项技能说明如何针对不同的数据库环境运行 MySQLTuner 检查工具。适合希望检查过程安全连接的数据库管理员。
适用场景
- ✓当你需要对本地、远程或容器化的数据库运行 MySQLTuner 时。
- ✓当你希望数据库密码不出现在命令行中时。
- ✓当你希望健康检查输出简洁或详细时。
技能链接
https://github.com/major/MySQLTuner-perl/blob/master/.agent/skills/cli-execution-mastery/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请对我的远程 MySQL 服务器运行 MySQLTuner,且不要在命令中输入密码。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会根据你的环境选择合适的连接选项,例如套接字、主机或容器,并使用设置文件或环境变量保存登录信息,而不是放在命令行中。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
CLI Execution Mastery Skill
🧠 Rationale
Mastering the CLI options of mysqltuner.pl allows for seamless execution across diverse environments while maintaining security and leveraging existing configurations.
🛠️ Implementation
1. Connection Discovery & Targeting
| Target Type | Primary Command/Options |
|---|---|
| Local Socket | perl mysqltuner.pl (Default) | --socket=/path/to/mysql.sock |
| Remote Host | perl mysqltuner.pl --host=1.2.3.4 --port=3306 |
| Container | perl mysqltuner.pl --container=container_name_or_id |
| Cloud/Azure | perl mysqltuner.pl --cloud --azure |
2. Authentication Strategies
[!IMPORTANT] Avoid passing passwords directly via
--passon the command line to prevent exposure in process lists.
Preferred:
.my.cnfUsage- Use
--defaults-file=/path/to/.my.cnfto point to a specific configuration file. - The script automatically respects common paths if not specified.
- Use
Environment Variables
- Use
--userenv=MY_USER_VARand--passenv=MY_PASS_VARto leverage pre-set credentials.
- Use
Password Files
- Use
--passwordfile=/path/to/passwords.txtfor batch security auditing.
- Use
3. Execution Contexts
- Standard Verbose Run:
perl mysqltuner.pl --verbose(Recommended for full diagnostics). - Silent Mode:
perl mysqltuner.pl --silent(Useful for automated data collection). - JSON Output:
perl mysqltuner.pl --jsonor--prettyjson(For integration with other tools).
4. Debugging Connections
If connection fails, use these flags to diagnose:
--debug: Enables full debug output.--dbgpattern='.*': Filters debug information with regex.- Verify
mysqlcmdpath if custom binaries are used:--mysqlcmd=/usr/local/bin/mysql.
5. MariaDB InnoDB Variable Compatibility
As MariaDB evolves, several InnoDB system variables have been removed or deprecated. mysqltuner.pl detects these to avoid legacy configuration overhead.
| Parameter | Removed/Deprecated In | Note/Replacement |
|---|---|---|
have_innodb |
Removed 10.0 | Use SHOW ENGINES or I_S.PLUGINS. |
innodb_adaptive_flushing_method |
Removed 10.0 | Replaced by MySQL 5.6 flushing logic. |
innodb_checksums |
Removed 10.0 | Use innodb_checksum_algorithm. |
innodb_stats_sample_pages |
Removed 10.5.0 | Use innodb_stats_transient_sample_pages. |
innodb_file_format / _check / _max |
Removed 10.6.0 | Antelope and Barracuda are legacy concepts. |
innodb_large_prefix |
Removed 10.6.0 | Always enabled in newer versions. |
innodb_locks_unsafe_for_binlog |
Removed 10.6.0 | No longer supported. |
innodb_prefix_index_cluster_optimization |
Deprecated 10.10 | Always enabled now. |
6. MySQL InnoDB Variable Compatibility
| Parameter | Removed/Deprecated In | Note/Replacement |
|---|---|---|
innodb_locks_unsafe_for_binlog |
Removed 8.0 | Use READ COMMITTED isolation level instead. |
innodb_support_xa |
Removed 8.0 | XA support is now always enabled. |
innodb_file_format family |
Removed 8.0 | Barracuda is the only supported format. |
innodb_large_prefix |
Removed 8.0 | Always enabled for Barracuda. |
tx_isolation / tx_read_only |
Removed 8.0 | Use transaction_isolation / transaction_read_only. |
innodb_undo_logs |
Removed 8.0 | Replaced by innodb_rollback_segments. |
innodb_undo_tablespaces |
Removed 9.0 | Managed automatically now. |
innodb_log_file_size |
Removed 9.0 | Replaced by innodb_redo_log_capacity. |
innodb_api_... variables |
Removed 8.4 | Memcached-related variables removed. |
✅ Verification
- Run
perl mysqltuner.pl --helpto confirm availability of these options. - Use
execute_system_commandto test connectivity with specific flags in the target environment.
常见问题
为什么要避免在命令行中输入密码?
命令行中的密码可能会在正在运行的进程列表中被看到,因此这项技能更推荐使用设置文件或环境变量。
它可以检查云数据库吗?
这项技能包含云端和 Azure 的相关选项。
有更安静的输出选项吗?
有。静默模式适合自动化收集,详细模式则提供完整的诊断信息。
详情
作者的原始描述
Mastery of MySQLTuner CLI options for connection and authentication.
repo: major/MySQLTuner-perl
热度
- GitHub 星标
- 9.5k
- 排名
- #12277
- 许可证
- GPL-3.0
- 更新时间
- 2026/10/28
评论
- …