Cette page est affichée en anglais. Une traduction française est en cours.
ScriptsApr 15, 2026·2 min de lecture

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.

Prêt pour agents

Staging sûr pour cet actif

Cet actif est d'abord staged. Le prompt copié demande à l'agent d'inspecter les fichiers staged avant d'activer scripts, config MCP ou config globale.

Stage only · 17/100Policy : staging
Surface agent
Tout agent MCP/CLI
Type
CLI Tool
Installation
Stage only
Confiance
Confiance : Established
Point d'entrée
mycli guide
Commande de staging sûr
npx -y tokrepo@latest install 4457836c-38c4-11f1-9bc6-00163e2b0d79 --target codex

Stage les fichiers d'abord; l'activation exige la revue du README et du plan staged.

TL;DR
mycli replaces the default mysql client with auto-completion, syntax highlighting, and formatting.
§01

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.

§02

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.

§03

How to use

  1. Install mycli: pip install mycli or brew install mycli.
  2. Connect to your database: mycli -h localhost -u root -p mydb.
  3. Start typing SQL and auto-completion activates automatically.
§04

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
§05

Related on TokRepo

§06

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-complete for faster startup on large schemas.
  • mycli uses less as the default pager. Large result sets page automatically. Set \P to 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.

Questions fréquentes

How does mycli differ from the default mysql client?+

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.

Does mycli support MariaDB?+

Yes. mycli is fully compatible with MariaDB and Percona Server. It uses the PyMySQL library which supports all MySQL-protocol-compatible databases.

Can mycli connect to cloud MySQL services?+

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.

Is mycli related to pgcli?+

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.

Does mycli support SSL connections?+

Yes. mycli supports SSL via the --ssl-ca, --ssl-cert, and --ssl-key flags. It passes SSL parameters through to the underlying PyMySQL connection.

Sources citées (3)

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires