This article covers how to install and use the MyCLI tool on your Ubuntu Linux system. In fact, MyCLI is an easy-to-use command line interface (CLI) for MySQL, MariaDB, and Percona, that helps you speed up development with auto-completion and syntax highlighting features.
How to install the MyCLI tool on your Linux system ?
MyCLI tool is based on Python and needs to be installed via pip. Make sure PIP and python development libraries are installed.:
$ yum install python-pip
$ yum -y install python-devel
$ pip install mycli
MyCLI Features include:
- Auto-completion as you type for SQL keywords as well as tables, views and columns in the database. Auto-completion is on by default. The REPL will pop up a suggestion menu as soon as you start typing. The suggestions are context sensitive based on the position of the cursor. eg: Only tables are suggested after the FROM keyword, only column names are suggested after the WHERE clause.
- Syntax highlighting using Pygments. Syntax highlighting has plenty of themes that can be changed via the config file.
- Smart-completion (enabled by default) will suggest context-sensitive completion.
- SELECT * FROM <tab> will only show table names.
- SELECT * FROM users WHERE <tab> will only show column names.
- Support for multiline queries.
- Favorite queries with optional positional parameters. Favorite Queries are a way to save frequently used queries with a short name. Save a query using \fs alias query and execute it with \f alias whenever you need.
- Timing of sql statments and table rendering.
- Config file is automatically created at ~/.myclirc at first launch.
- Log every query and its results to a file (disabled by default).
- Pretty prints tabular data (with colors).
- Support for SSL connections.
- There are two types of keybindings available. Emacs mode and Vi mode
- Cross-platform support – runs under Linux and macOS. The software may run under Windows but this is not tested.