
mycli
MySQL command line client with auto-completion, syntax highlighting, and smart context-aware SQL suggestions
mycli is a MySQL command line client that enhances the standard mysql CLI with interactive features. Built on Python Prompt Toolkit, it provides auto-completion for SQL keywords, table names, views, and columns as the user types. The tool includes context-aware smart completion that suggests only relevant options based on query context - for example, showing only table names after SELECT * FROM and only column names in WHERE clauses.
The client supports fuzzy history search using fzf, syntax highlighting via Pygments, and multiline queries. Users can save favorite queries with positional parameters using \fs commands and execute them with \f aliases. Additional features include query timing, result logging to files, SSL connection support, and shell-style output redirection with $>, $>>, and $| operators.
mycli targets database administrators, developers, and anyone working regularly with MySQL databases who wants a more interactive command line experience. It creates a ~/.myclirc configuration file on first run for customizing behavior and key bindings. The tool requires Python 3.10+ and runs on macOS and Linux, with experimental Windows support through WSL or native installation.
Installation
# via pip
pip install -U 'mycli[all]'
# via Homebrew
brew update && brew install mycli
# via apt
sudo apt-get install mycli


Alternatives & related tools
pgcli
Interactive PostgreSQL client with auto-completion, syntax highlighting, and smart context-sensitive suggestions.
visidata
Terminal interface for exploring and arranging tabular data with support for CSV, JSON, SQLite, Excel, and many other formats.
jc
Converts output of CLI tools, file types, and strings to JSON or Python dictionaries so it can be piped to jq and used in scripts.
litecli
Command-line client for SQLite databases with auto-completion and syntax highlighting.
dolphie
Real-time terminal interface for monitoring MySQL/MariaDB and ProxySQL database performance and analytics
add a badge to your README
Maintain mycli? Show that it's featured on trmn. The badge links back to this page.
[](https://www.trmn.sh/tools/mycli?utm_source=badge)<a href="https://www.trmn.sh/tools/mycli?utm_source=badge"><img src="https://www.trmn.sh/badge/mycli.svg" alt="Featured on trmn" height="20"></a>