mycli — MySQL CLI with Auto-Completion and Syntax Highlighting
mycli is a Python-based interactive CLI for MySQL/MariaDB/Percona with smart auto-completion, syntax highlighting, and result formatting — sister project to pgcli.
这个资产会安全暂存
这个资产会先安全暂存。复制的指令会要求 Agent 读取暂存文件,并在激活脚本、MCP 配置或全局配置前先确认。
npx -y tokrepo@latest install 4457836c-38c4-11f1-9bc6-00163e2b0d79 --target codex先暂存文件;激活前需要读取暂存 README 和安装计划。
What it is
mycli is a Python-based interactive CLI for MySQL, MariaDB, and Percona with smart auto-completion, syntax highlighting, and result formatting. It is the MySQL counterpart of pgcli, part of the dbcli project family.
The tool serves database administrators, backend developers, and data engineers who work with MySQL from the terminal and want a more productive alternative to the default mysql client.
How it saves time or tokens
mycli auto-completes table names, column names, and SQL keywords as you type, eliminating the need to look up schema details manually. Syntax highlighting catches typos visually before you run the query. Formatted output with proper alignment makes result sets readable without copying to a spreadsheet.
How to use
- Install mycli:
pip install mycliorbrew install mycli. - Connect to your database:
mycli -h localhost -u root -p mydb. - Start typing SQL and auto-completion activates automatically.
Example
# Install
pip install mycli
# Connect to a local MySQL database
mycli -h localhost -u root mydb
# Inside mycli, auto-completion works as you type:
# SELECT * FROM or -> suggests: orders, organizations
# SELECT o.id, o.sta -> suggests: status, start_date
# Useful features:
# \T - change output format (table, csv, tsv)
# \f - toggle output to file
# F2 - toggle smart completion mode
# \dt - list tables
Related on TokRepo
- AI Tools for Database -- database management tools and utilities
- Automation Tools -- tools for automating development workflows
Common pitfalls
- mycli's auto-completion loads the schema at connection time. For databases with many tables, this can delay the initial prompt. Use
--no-auto-completefor faster startup on large schemas. - mycli uses less as the default pager. Large result sets page automatically. Set
\Pto change the pager or disable it. - Some MySQL 8.0 features (like CTEs with recursive) work correctly in mycli, but auto-completion may not suggest CTE syntax.
常见问题
mycli adds intelligent auto-completion for tables, columns, and functions, syntax highlighting, multi-line editing, and formatted output. The default mysql client provides none of these features. mycli uses the same connection parameters so it is a drop-in replacement.
Yes. mycli is fully compatible with MariaDB and Percona Server. It uses the PyMySQL library which supports all MySQL-protocol-compatible databases.
Yes. mycli connects to Amazon RDS, Google Cloud SQL, Azure Database for MySQL, PlanetScale, and any other MySQL-compatible cloud service using standard connection parameters.
Yes. Both are part of the dbcli project. pgcli is for PostgreSQL, mycli is for MySQL. They share the same design philosophy and similar user experience.
Yes. mycli supports SSL via the --ssl-ca, --ssl-cert, and --ssl-key flags. It passes SSL parameters through to the underlying PyMySQL connection.
引用来源 (3)
- mycli GitHub— Python-based MySQL CLI with auto-completion
- dbcli Project— Part of the dbcli project family
- mycli Official Site— Smart completion for MySQL syntax and schema
讨论
相关资产
pgcli — PostgreSQL CLI with Auto-Completion and Syntax Highlighting
pgcli is a modern `psql` replacement in Python with intelligent auto-completion for tables/columns/functions, syntax highlighting, multi-line editing, and output formatting.
Python Prompt Toolkit — Build Powerful Interactive Command Lines
Python Prompt Toolkit is a library for building interactive command-line applications in Python. It powers tools like IPython, pgcli, and mycli with features like syntax highlighting, auto-completion, multiline editing, and vi/emacs key bindings.
ros2ai — ROS 2 CLI Extension with LLMs
ros2ai is a ROS 2 CLI extension that answers ros2 questions and runs common tasks using OpenAI-compatible APIs or Ollama (local).
Cobra — Modern CLI Framework for Go Applications
Cobra is the most popular Go library for building command-line applications. It powers the CLI of Kubernetes (kubectl), GitHub CLI, Docker, Hugo, and hundreds of other tools — providing subcommands, flags, auto-generated help, and shell completions.