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.
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.02: Simple completions such as keywords and sql-functions.
Gif.01: Auto-completion and syntax demo
See also
- Save time use MySQL/MariaDB auto completion for database or table names with auto-rehash option
- mycli home page
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
- RSS feed or Weekly email newsletter
- Share on Twitter • Facebook • 3 comments... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
So exactly the same as the default Mariadb and MySQL CLI?
What is the point?
The default does not offer syntax highlight, db/table selection and much more.
The same goes for PostgreSQL : https://www.pgcli.com/