home / databases / mycli

mycli

12k

MySQL client for interactive querying, schema-aware completion, and batch SQL execution.

$pip install -U 'mycli[all]'
Language
Python
Stars
11,882
Category
Databases
Agent
Ready
Agent Compatibility
JSON Output
Agent Skill
MCP Support
AI Analysis

mycli is a MySQL client that combines an interactive prompt with batch SQL execution, schema-aware completion, and flexible result formatting. It fits best when you want one CLI for both exploratory database work and scripted query runs.

What It Enables
  • Connect to MySQL servers, list databases or tables, and run ad hoc SQL with completions, saved queries, and editor handoff.
  • Execute SQL from -e, stdin, or sourced files, then emit table, CSV, or TSV output or redirect results into files and shell commands.
  • Reuse DSNs, MySQL config files, SSH tunnel settings, SSL settings, and keyring-backed passwords when moving between environments.
Agent Fit
  • Batch mode, --execute, --noninteractive, and --format flags give agents a real non-interactive path for running SQL.
  • CSV and TSV are first-class output modes, and JSONL is available as a supported table format for workflows that need structured records.
  • Most differentiation is still human-first: autocomplete, syntax highlighting, history search, and prompt editing matter more to operators than to unattended agents.
Caveats
  • There is no simple dedicated --json flag; JSONL output depends on table-format configuration or interactive format changes.
  • Credentials and live database reachability are required, and SSH or SSL setup can add extra session friction.