MyCLI – A MySQL/MariaDB Client with Auto-completion and Syntax-highlighting

MyCLI is an easy-to-use command line (CLI) interface for the popular database management systems: MySQL, MariaDB, and Percona with auto-completion and syntax highlighting. It is built using prompt_toolkit and requires Python 2.7, 3.3, 3.4, 3.5, and 3.6. It supports secure connections over SSL to the MySQL server.

MyCLI Features

When you first start it, a config file is automatically created at ~/.myclirc.

Supports auto-completion while typing SQL keywords as well as tables, views and columns in the database.

Also supports smart-completion which is enabled by default and will offer suggestions for context-sensitive completion.

For instance:

SELECT * FROM <Tab> - this will just show table names.
SELECT * FROM users WHERE <Tab> - this will simply show column names.

Supports syntax highlighting using Pygments.

Support for SSL connections.

Offers support for multiline queries.

It optionally logs every query and its output to a file (note that this is disabled by default).

Allows you to save favorite queries (save a query using \fs alias and run it with \f alias).

Supports timing of SQL statements and table rendering.

Prints tabular data in an appealing way.

How to Install MyCLI for MySQL and MariaDB in Linux

On Debian/Ubuntu distributions, you can easily install the mycli package using apt command as follows:

$ sudo apt-get update
$ sudo apt-get install mycli

Likewise, Fedora 22+ has a package available for mycli, you can install it using dnf command as below:

$ sudo dnf install mycli

For other Linux distributions such as RHEL/CentOS, you’ll need Python pip tool to install mycli. Start by installing pip with the commands below:

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.