Hello, friends. This post is oriented to those people who make MySQL / MariaDB / Percona their day-to-day work. This is because today you will learn how to install MyCli on Ubuntu 20.04. And you will discover the benefits that this small tool can bring you
Okay, what is MyCli?
MyCli is a command-line interface for MySQL, MariaDB, and Percona with auto-completion and syntax highlighting.
Yes, as you read it with MyCli you have a top layer of the MySQL shell that allows you to extend the functionalities of it. One of them is auto-completion which is a great help if we work with many tables and or databases simultaneously. This has an impact on our productivity and the improvement in work times.
Some of the main features of this tool are:
- Auto-completion as you type for SQL keywords as well as tables, views and columns in the database.
- Syntax highlighting using Pygments.
- Smart-completion (enabled by default) will suggest context-sensitive completion.
- Support for multiline queries.
- Favorite queries with optional positional parameters.
- Timing of sql statments and table rendering.
Install MyCLi on Ubuntu 20.04 / Linux Mint 20
MyCli has several ways to install on Ubuntu 20.04 / Linux Mint, which makes it very easy. Now I will introduce you to different ways and you can choose the one that best suits you.
1.- Install MyCli on Ubuntu 20.04 / Linux Mint 20 from the official repository
This method is the safest we have. Since MyCli is present in the official repositories of Ubuntu 20.04 and Linux Mint 20. Then all we have to do is open a terminal and execute these commands:
sudo apt update
sudo apt install mycli
And with this, it will be installed in the system.
2.- Install MyCli using Homebrew
We have talked about Homebrew in this blog and we think it is a very interesting tool to use in Linux. While it is true that its main use is focused on macOS is also usable in Linux.
Well, MyCli is available using this tool too, but first, we have to learn how to install it:
How to install Homebrew on Ubuntu 20.04 / Debian 10?
Once Homebrew is ready for work, just run these commands:
brew update
brew install mycli
The main advantage of this method is that you get the latest stable version of the tool.
3.- Using PIP
Being a tool created in Python, it is also possible to install it using PIP. So the installation is also easy and fast.
How To Install PIP on Ubuntu 20.04?
After PIP is ready, you can install MyCli in the following way:
sudo pip install -U mycli
And with this, it will be installed.
This method also installs the latest version of MyCli and is useful if you use a lot of Python.
Using MyCli on Ubuntu 20.04 / Linux Mint
Using MyCli is very easy because it is not intended to be a replacement for the MySQL shell but to provide more and better features.
So, to deploy the command help, just open a terminal and run:
mycli --help
And you will have the following screen output
And then, you can connect to a database in the following way
mycli -u [user] -h [host] -p [database]
And once inside the shell, you can start using MySQL as usual but taking advantage of autocompletion and highlighting.
So, enjoy it.
Conclusion
MyCli is a very important tool for many developers who use many MySQL shells. Perfectly compatible with MariaDB and Percona it is a great help in the daily work