explaingit

dbcli/mycli

11,909PythonAudience · developerComplexity · 2/5Setup · easy

TLDR

A smarter MySQL terminal client that auto-completes SQL keywords, table names, and column names as you type, and adds syntax highlighting and query history search to your database sessions.

Mindmap

mindmap
  root((mycli))
    Core Features
      Smart autocomplete
      Syntax highlighting
      Query history search
    Productivity
      Query aliases
      Query logging
      Multiline queries
    Connectivity
      SSL connections
      Pipe to shell tools
      LLM integration
    Installation
      pip install
      Homebrew macOS
      Linux packages
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Replace the default mysql CLI with context-aware autocomplete so you stop forgetting column names mid-query.

USE CASE 2

Save frequently used queries as short aliases and call them back by name to speed up repetitive database work.

USE CASE 3

Debug a MySQL database on a remote server via SSH with a readable, colored results display instead of raw table output.

USE CASE 4

Use the LLM integration feature to query your database in plain English using your schema as context.

Tech stack

PythonMySQL

Getting it running

Difficulty · easy Time to first run · 5min

Requires Python 3.10 or newer. Windows not officially supported, use WSL.

In plain English

mycli is a command-line tool for working with MySQL databases. MySQL is a widely used database system, and the standard way to interact with it from a terminal is through the official mysql client, which is functional but minimal. mycli replaces that experience with something more helpful: as you type a query, it suggests completions for SQL keywords, table names, column names, and function names based on what it knows about your database. The autocomplete is context-aware. If you type a SELECT statement and then a FROM clause, the suggestions will show table names. If you continue to a WHERE clause, they switch to column names from the table you already chose. This reduces the need to memorize exact names or check a separate schema reference while writing queries. Beyond autocomplete, the tool colors SQL syntax to make queries easier to read, formats query results as clean tables with colors, and supports searching through previous queries using a fuzzy search tool. You can save frequently used queries under short aliases and call them back by name, optionally with parameters. Every query can optionally be logged to a file for later reference. The tool also supports SSL connections to databases, multiline queries, and the ability to pipe query output to other command-line tools using shell-style redirect operators. A recent addition lets you query language models using your database schema as context. Installation is available through pip on any platform, Homebrew on macOS, and the package managers of several Linux distributions including Debian, Ubuntu, Fedora, and Arch. It requires Python 3.10 or newer and is primarily tested on macOS and Linux. Windows is not officially supported but may work through the Windows Subsystem for Linux.

Copy-paste prompts

Prompt 1
I just installed mycli. Show me how to connect to a local MySQL database called 'myapp', run a SELECT on a table, and use the fuzzy history search to recall a previous query.
Prompt 2
How do I create a mycli alias called 'active_users' for the query SELECT * FROM users WHERE last_login > NOW() - INTERVAL 7 DAY so I can run it by typing just '\active_users'?
Prompt 3
Walk me through setting up an SSL connection to a remote MySQL database using mycli, including which flags to pass for the certificate files.
Prompt 4
I want to pipe mycli query output to a CSV file. Show me the exact mycli command and any output-format flag I need to produce a clean CSV.
Open on GitHub → Explain another repo

← dbcli on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.