What is MyCLI?

MyCLI Auto-completion

MyCLI fixes the biggest annoyance with the standard MySQL client: typing table names without auto-completion like some kind of caveman. Also, the syntax highlighting actually helps you spot typos before you run queries that lock half your database.

Born from the simple frustration of retyping very_long_table_name_with_underscores for the 47th time in a day, MyCLI transforms the MySQL command line from a masochistic exercise into something you might actually enjoy using. It's what the MySQL client should have been from the start.

Developed as part of the dbcli project, it's built using Python and the prompt_toolkit library. The standard MySQL client's error messages are about as helpful as fortune cookies - MyCLI actually tells you what went wrong. Check out the complete feature documentation for all the ways it improves your workflow.

The tool was successfully funded through Kickstarter and has gained significant adoption with over 11.7k stars on GitHub as of September 2025. It works with MySQL, MariaDB, and Percona databases, though you'll probably run into some fun edge cases if you're using MemSQL or other MySQL-compatible databases. The community is active and responsive to bug reports.

Core Features That Set MyCLI Apart

Intelligent Auto-completion: Auto-completion works great until you connect to a schema with 200+ tables, then it gets sluggish as hell. When you enter SELECT * FROM <tab>, it shows only table names. Type SELECT * FROM users WHERE <tab> and it displays only column names from the users table. Sometimes gets confused with complex subqueries and suggests garbage, but it beats manually typing table_with_ridiculously_long_name for the 47th time. The smart completion documentation explains how it works, and you can configure it to suit your workflow. If performance becomes an issue on large schemas, check out the performance tips from other users.

Syntax Highlighting: SQL statements are color-coded using Pygments, which has saved me from running DELETE without WHERE more times than I'll admit. Multiple color themes are available so you can pick something that doesn't burn your retinas during those 3am debugging sessions. The syntax highlighting is powered by Pygments, the same library used by many other tools. You can even create custom themes if you're feeling fancy.

Enhanced User Experience: Unlike the standard MySQL client, MyCLI doesn't require semicolons to execute queries by default (thank god), supports multiline queries naturally, and provides error messages that actually make sense. Query timing is built-in, so you can see exactly how slow your JOINs are without doing mental math. It also supports paging for large results, query logging, and output redirection like a proper Unix tool.

Works with MySQL's Bastard Cousins: While focused on MySQL, MyCLI works with MariaDB and Percona Server without breaking. Just don't expect miracles with their weird edge cases.

The tool requires Python 3.9+ (don't try 3.8, it'll break mysteriously) and is actively maintained with regular updates. The latest version v1.38.4 was released on September 6, 2025, fixing timing being printed twice and other annoying bugs. Updates come regularly, which is great until one of them breaks your aliases.

Installation and Getting Started

MyCLI Installation
Python Version
Downloads

Installing MyCLI is straightforward unless you're one of those people who has seventeen different Python installations fighting each other. Here are the ways to install this thing, though some work better than others:

Python Package Installation (Recommended):

pip install -U mycli

Usually works, but if you're on macOS with Apple Silicon, expect some compilation warnings that you can ignore. If you hit dependency conflicts with your existing PyMySQL, you're in for a fun afternoon of virtual environment juggling. Check the installation docs for troubleshooting tips, or browse GitHub issues to see how others solved similar problems.

macOS via Homebrew:

brew update && brew install mycli

Homebrew version lags behind pip by like 2 months. Works fine but you'll miss the latest bug fixes.

Linux Distribution Packages:

  • Ubuntu/Debian: sudo apt-get install mycli (Ubuntu package is ancient, use pip unless you enjoy bugs that were fixed 6 months ago)
  • Fedora: sudo dnf install mycli
  • Arch/Manjaro: yay -S mycli

The installation creates a configuration file at ~/.myclirc on first launch. If you're on Windows, you might hit a Unicode encoding issue with weird em-dashes in the config file. Just delete the config and regenerate it - fixes 90% of startup problems. The configuration reference explains all the settings you can customize once you get it working.

The Actually Useful Features

Favorite Queries: Save frequently used queries with custom aliases using \fs alias query and execute them later with \f alias. This supports positional parameters, so you can template queries without copy-pasting like an animal. Check out the commands documentation for all available shortcuts.

Query Logging: All executed queries and their results can be logged to a file (disabled by default). Enable logging through the configuration file or command-line options for audit trails or debugging purposes. Just don't forget to rotate the logs or your disk will fill up eventually.

SSL Support: MyCLI supports secure connections with SSL configuration options including custom certificates, CA paths, and cipher specifications. If you're getting SSL permission errors, check your certificate file permissions.

SSH Tunneling: Connect to remote MySQL servers through SSH tunnels using --ssh-host jumpbox.company.com --ssh-user youruser. Setup is a pain in the ass the first time, but works great when IT gives you a VPN that breaks everything else. The SSH documentation has examples for both password and key-based authentication.

Shell-style Output Redirection: Use $>, $>>, and $| operators to redirect query results to files or pipe them to other commands, similar to Unix shell operations. The commands reference shows all the redirection options available.

Multiple Connection Methods: Connect using traditional parameters, connection strings, MySQL's login-path feature, or DSN configurations stored in the MyCLI configuration file. The connection documentation explains all the different ways to authenticate.

Configurable Interface: Customize prompts, paging behavior, output formats (table, CSV), and keybindings (Emacs or Vi modes) to match your workflow preferences. The interface is powered by prompt_toolkit, so it's quite flexible.

Performance and Compatibility

MyCLI is tested on macOS and Linux. Not officially tested on Windows, but it should work. If it doesn't, you'll find plenty of GitHub issues to learn from.

Query timing is built-in, so you can see exactly how slow your JOINs are. Connection times to large schemas can take forever - if auto-completion is crawling, that's probably why. Memory usage stays reasonable unless you're dealing with massive result sets. Check the performance FAQ for tips on speeding things up with large databases.

MyCLI vs Database CLI Alternatives

Feature

MyCLI

Standard MySQL CLI

pgcli

DBeaver

HeidiSQL

Auto-completion

✅ Context-aware (slow on large schemas)

❌ None

✅ Context-aware

✅ GUI-based

✅ GUI-based

Syntax Highlighting

✅ Multiple themes

❌ None

✅ Multiple themes

✅ GUI editor

✅ GUI editor

Database Support

MySQL, MariaDB, Percona

MySQL, MariaDB

PostgreSQL only

Multi-database

Multi-database

Cross-platform

✅ macOS, Linux, Windows*

✅ All platforms

✅ macOS, Linux, Windows*

✅ All platforms

✅ Windows, Linux

Interface Type

Terminal/CLI

Terminal/CLI

Terminal/CLI

Desktop GUI

Desktop GUI

Configuration

~/.myclirc file

/etc/mysql/my.cnf

~/.pgclirc file

GUI preferences

GUI preferences

Query History

✅ With search (Ctrl+R)

✅ Basic history

✅ With search (Ctrl+R)

✅ GUI history

✅ GUI history

SSL Support

✅ Full SSL options

✅ Full SSL options

✅ Full SSL options

✅ SSL support

✅ SSL support

SSH Tunneling

✅ Built-in (pain in the ass first time)

❌ Manual setup

✅ Built-in support

✅ SSH tunneling

✅ SSH tunneling

Output Formats

Table, CSV, redirects

Table, CSV, XML

Table, CSV, redirects

Export options

Export options

Favorite Queries

✅ With parameters

❌ None

✅ With parameters

✅ Bookmarks

✅ Bookmarks

Multi-line Queries

✅ Natural support (unless you forget \G)

✅ Requires semicolon

✅ Natural support

✅ GUI editor

✅ GUI editor

Pager Support

✅ Configurable

✅ Basic

✅ Configurable

N/A (GUI)

N/A (GUI)

Open Source

✅ BSD License

✅ GPL License

✅ BSD License

✅ Apache License

✅ GPL License

Resource Usage

Low (Python overhead)

Minimal (C binary)

Low (Python overhead)

Heavy (Java + GUI rendering)

Medium (GUI)

Frequently Asked Questions

Q

What databases does MyCLI support?

A

MyCLI supports MySQL, MariaDB, and Percona Server. It's designed for MySQL-compatible databases with auto-completion and syntax highlighting that actually works with MySQL SQL dialect.

Q

How do I enable auto-completion in MyCLI?

A

Auto-completion should just work, but if it's not showing up, you probably have an old config file. Delete ~/.myclirc and restart

  • that fixes it 90% of the time. If your database has 500+ tables, auto-completion will be slower than molasses.
Q

Can I use MyCLI with SSL connections?

A

Yes, MyCLI supports SSL. Use options like --ssl-cert, --ssl-key, --ssl-ca, and --ssl-verify-server-cert to configure secure connections. SSL settings can also be stored in the configuration file.

Q

How do I connect when IT gave me a VPN that breaks everything?

A

Use SSH tunneling: mycli --ssh-host jumpbox.company.com --ssh-user youruser -h 10.0.0.123. Takes forever to type but works when nothing else will. If you get `(2003, "Can't connect to My

SQL server on 'localhost'")`, MyCLI tried the socket first and failed

  • just wait for it to retry over TCP/IP.
Q

Where is the MyCLI configuration file located?

A

The configuration file is located at ~/.myclirc in your home directory. It's automatically created on first launch and contains settings for colors, keybindings, auto-completion, and connection defaults.

Q

How do I save and reuse favorite queries?

A

Save a query using \fs alias query_text and execute it later with \f alias. Favorite queries are great once you remember to actually use them. They support parameters, so you can do \fs users SELECT * FROM users WHERE status = ? and call it with arguments.

Q

Can I change the color scheme or syntax highlighting?

A

Yes, MyCLI supports multiple color themes. Modify the syntax_style setting in ~/.myclirc to choose from themes like default, monokai, vim, or others.

Q

How do I enable query logging?

A

Enable logging by adding log_file = ~/.mycli.log to your configuration file or use the -l command-line option. This logs all queries and results for audit or debugging purposes.

Q

Why should I use MyCLI instead of the standard MySQL client?

A

The standard MySQL client makes you feel like you're using telegraph equipment. MyCLI adds auto-completion that saves your ass when you can't remember if it's user_id or userid, syntax highlighting so you don't accidentally run DELET instead of DELETE, and error messages that actually make sense.

Q

Is MyCLI compatible with my existing MySQL setup?

A

Yes, MyCLI uses the same connection protocols and authentication methods as the standard MySQL client. It works with existing MySQL users, privileges, and connection configurations.

Q

How do I update MyCLI to the latest version?

A

Update using pip install -U mycli for pip installations, brew upgrade mycli for Homebrew on mac

OS, or use your system's package manager for distribution-specific packages. Sometimes updates break your workflow

  • if something's working, maybe don't update it right before a deadline.
Q

Can I use MyCLI in scripts or automation?

A

Yes, but why would you? Use the regular mysql client for scripts. MyCLI is for interactive work where you actually want to be productive.

Q

Why does MyCLI randomly disconnect during long queries?

A

Usually a timeout issue on the MySQL side. Check your wait_timeout and interactive_timeout settings. If you're seeing Protocol error, expecting EOF, your connection probably got reset mid-query.

Q

How do I stop it from logging my passwords in plain text?

A

Don't put passwords on the command line. Use mysql_config_editor to store credentials or put them in ~/.my.cnf. If you must use command line passwords, at least put a space before the command so it doesn't go in your shell history.

Q

Can I make it shut up about SSL warnings?

A

Add ssl_disabled = True to your ~/.myclirc file. Or properly configure SSL if you're connecting over the internet like a responsible adult.

Q

Why is auto-completion slow as hell on our prod database?

A

Your schema has too many tables. MyCLI loads all table and column names for auto-completion. With 1000+ tables, this takes forever. You can disable it with smart_completion = False in your config, but then what's the point?

Essential Resources and Documentation