Xpersona
M

MySQL Database CLI Skill

CLAWHUB · Unverified

MySQL 数据库操作技能。通过 mysql CLI 连接数据库,执行 SELECT 查询、INSERT/UPDATE/DELETE 增删改、批量 SQL 执行、事务控制、数据库/表管理、JSON 格式输出。适用场景:查用户数据、统计报表、数据导入导出、数据库巡检、表结构查看、远程连接、生产环境调试。触发关键词:... Skill: MySQL Database CLI Skill Owner: 429668385 Summary: MySQL 数据库操作技能。通过 mysql CLI 连接数据库,执行 SELECT 查询、INSERT/UPDATE/DELETE 增删改、批量 SQL 执行、事务控制、数据库/表管理、JSON 格式输出。适用场景:查用户数据、统计报表、数据导入导出、数据库巡检、表结构查看、远程连接、生产环境调试。触发关键词:... Tags: latest:1.0.1 Version history: v1.0.1 | 2026-04-01T07:57:25.998Z | user Added copyright: 少煊 <429668385@qq.com> v1.0.0 | 2026-04-01T07:53:15.164Z | user Initial release: MySQL database operations w

62
Rank
84
Safety
1.4k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.4K downloads reported by the source. Last updated 10/10/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s1761ynrawgks950k2cp4grq99841ssb:mysql-database-skill
  1. Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-429668385-mysql-database-skill/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

26,696 characters of source documentation, loaded on request.

Extracted files

3 files captured from the source.

SKILL.md

---
name: mysql-database
description: "MySQL 数据库操作技能。通过 mysql CLI 连接数据库,执行 SELECT 查询、INSERT/UPDATE/DELETE 增删改、批量 SQL 执行、事务控制、数据库/表管理、JSON 格式输出。适用场景:查用户数据、统计报表、数据导入导出、数据库巡检、表结构查看、远程连接、生产环境调试。触发关键词:MySQL、数据库查询、SQL 语句执行、连接数据库、查表、数据增删改、jdbc 连接字符串、navicat、数据库迁移、DESCRIBE TABLE、查看表结构、表字段分析、查看索引、EXPLAIN 查询分析。"
license: "Copyright © 2026 少煊(年少有为,名声煊赫)<429668385@qq.com>. All rights reserved."
---

# MySQL Database Skill

Use the `mysql` CLI to connect to and interact with MySQL databases. Use the `-e` flag to execute SQL statements and the `-s` (`--silent`) flag to produce clean output suitable for processing. Combine with `-r` (`--raw`) to avoid escaping, and pipe the result to `jq` for reliable JSON formatting.

## 快速使用场景

### 场景 1: 查询数据(最常用)

```bash
mysql -h <host> -u <user> --database <db> -s -r -e "SELECT * FROM users LIMIT 10;" 2>$null
```

### 场景 2: 查看表结构

```bash
mysql -h <host> -u <user> --database <db> -s -r -e "DESCRIBE users;" 2>$null
```

### 场景 3: 插入/更新/删除数据

```bash
# 插入
mysql -h <host> -u <user> --database <db> -s -r -e "INSERT INTO users (name, email) VALUES ('Test', 'test@example.com');" 2>$null

# 更新
mysql -h <host> -u <user> --database <db> -s -r -e "UPDATE users SET status=1 WHERE id=1;" 2>$null

# 删除
mysql -h <host> -u <user> --database <db> -s -r -e "DELETE FROM users WHERE id=1;" 2>$null
```

### 场景 4: 统计数据报表

```bash
mysql -h <host> -u <user> --database <db> -s -r -e "SELECT COUNT(*) as total, SUM(amount) as revenue FROM orders WHERE DATE(create_time)=CURDATE();" | jq -s '.'
```

### 场景 5: 导出数据到文件

```bash
mysql -h <host> -u <user> --database <db> -s -r -e "SELECT * FROM users INTO OUTFILE '/tmp/users.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\n';" 2>$null
```

### 场景 6: 执行 SQL 脚本文件

```bash
mysql -h <host> -u <user> --database <db> -s -r < script.sql 2>$null
```

## 数据库连接

### 基础连接

```bash
mysql -h <hostname> -P <port> -u <username> --database <database-name> -s -r
```

**示例 (连接本地数据库):**
```bash
MYSQL_PWD=yourpassword mysql -h 127.0.0.1 -u app_user --database app_db -s -r
```

### 从 JDBC URL 解析连接参数

用户可能提供 JDBC URL 格式:`jdbc:mysql://host:port/database`,需要解析为 mysql CLI 参数:

```
jdbc:mysql://nexus.syrinxchina.com:3306/test3
  → -h nexus.syrinxchina.com -P 3306 --database test3
```

```bash
# 示例:从 JDBC URL 构建连接
JDBC_URL="jdbc:mysql://nexus.syrinxchina.com:3306/test3"
HOST=$(echo $JDBC_URL | sed -n 's/.*:\/\/\([^:]*\):\([0-9]*\)\/\(.*\)/\1/p')
PORT=$(echo $JDBC_URL | sed -n 's/.*:\/\/\([^:]*\):\([0-9]*\)\/\(.*\)/\2/p')
DB=$(echo $JDBC_URL | sed -n 's/.*:\/\/\([^:]*\):\([0-9]*\)\/\(.*\)/\3/p')
mysql -h "$HOST" -P "$PORT" -u root --database "$DB" -s -r
```

### 连接参数表

| Option | Description |
|--------|-------------|
| `-h` | Hostname (default: localhost) |
| `-P` | Port (default: 3306) |
| `-u` | Username |
| `-p` | Prompt for password (less secure, avoid in scripts) |
| `-D` / `--database` | Default database |
| `-e` | Execute query and exit |
| `-s` | Silent mode (no headers/borders) |
| `-r` | Raw mode (no

_meta.json

{
  "ownerId": "kn797g6cg7rn0nw596sg92g8ah8407gz",
  "slug": "mysql-database-skill",
  "version": "1.0.1",
  "publishedAt": 1775030245998
}

skill-card.md

## Description:

Uses the MySQL CLI to help agents connect to MySQL databases, run queries and data changes, inspect schemas, manage imports and exports, and format results as JSON.

This skill is ready for commercial/non-commercial use.

## Publisher:

[429668385](https://clawhub.ai/user/429668385)

### License/Terms of Use:

MIT-0

## Use Case:

Developers and database operators use this skill to have an agent prepare and run MySQL CLI commands for querying data, inspecting schemas, generating reports, importing and exporting data, and troubleshooting database connections.

### Deployment Geography for Use:

Global

## Known Risks and Mitigations:

Risk: The skill can guide broad database writes, bulk import or export, script execution, schema changes, and administrative actions.

Mitigation: Use it only with explicit user-directed database targets, least-privilege accounts, reviewed SQL, staging systems or backups for writes, and confirmation before write, import, export, schema, script, or admin actions.

Risk: Credential-handling examples may expose secrets if passwords are placed in commands, process lists, shell history, or unsecured config files.

Mitigation: Prefer interactive password prompts, mysql_config_editor, or an approved secret manager; secure any client configuration files and avoid command-line passwords.

Risk: Use against production or sensitive databases could cause data loss, disclosure, or service impact.

Mitigation: Avoid production use unless the agent is required to request confirmation before risky actions and the operator has appropriate backups, access controls, and change-review procedures.

## Reference(s):

- [ClawHub skill page](https://clawhub.ai/429668385/skills/mysql-database-skill)

## Skill Output:

**Output Type(s):** [text, markdown, code, shell commands, configuration, guidance]

**Output Format:** [Markdown with SQL, shell command, JSON, and configuration snippets]

**Output Parameters:** [1D]

**Other Properties Related to Output:** [May include JSON output patterns for query results and safety guidance for database credentials and write operations.]

## Skill Version(s):

1.0.1 (source: server release metadata)

## Ethical Considerations:

Users should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.

Sponsored

Ads related to MySQL Database CLI Skill and adjacent AI workflows.