mycli: Awesome MySQL/MariaDB mysql client with auto-completion and syntax highlighting

I already wrote about auto-completion in the MySQL/MaiaDB command-line client using an auto-rehash feature. Recently I found out a new tool called mycli. It is a command line interface for MySQL, MariaDB, and Percona with auto-completion and syntax highlighting.

This tool is written in Python. You need to use pip command to install it on Linux or Unix-like system. This tool support auto-completion table names, database names, aliases, SQL syntax, keeps track of the queries entered, and much more.

ADVERTISEMENTS

Installation

If pip not installed on a Debian/Ubuntu Linux, type the following apt command/apt-get command:
$ sudo apt install python-pip
If you are using RHEL/CentOS, use yum command to install the same:
$ sudo yum install python-pip

Install mycli

Type the following command on Linux or Unix-like system to install mycli:
$ pip install mycli
If you are using macOS Unix, type the following brew command to install mycli:
$ brew update && brew install mycli
Sample outputs:

==> Downloading https://homebrew.bintray.com/bottles/mycli-1.10.0.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring mycli-1.10.0.sierra.bottle.tar.gz
==> Using the sandbox
🍺  /usr/local/Cellar/mycli/1.10.0: 1,293 files, 24.4MB

How do I use mycli command?

The syntax is:
$ mycli -u user -p db_name
$ mycli -u user -h host_name -p db_name

Sample outputs:

Fig.01: mycli in action

Fig.01: mycli in action

Let us see mycli auto complete feature. Just start typing sql command such as show dat:
Fig.02: Simple completions such as keywords and sql-functions.

Fig.02: Simple completions such as keywords and sql-functions.

Here is a small demo:
Gif.01: Auto-completion and syntax demo

Gif.01: Auto-completion and syntax demo

See also

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source & DevOps topics via:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
3 comments… add one
  • Daniel May 18, 2017 @ 6:26

    So exactly the same as the default Mariadb and MySQL CLI?

    What is the point?

    • 🐧 Vivek Gite May 18, 2017 @ 7:02

      The default does not offer syntax highlight, db/table selection and much more.

  • Goabbear May 18, 2017 @ 7:58

    The same goes for PostgreSQL : https://www.pgcli.com/

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.