Found a very convenient tool
MyCli
MyCli is a MySQL command line tool that supports automatic completion and syntax highlighting. It can also be used for MariaDB and Percona.
Use prompt_toolkit to compile mycli
When you enter SQL keywords, tables and columns in the database, auto-completion is enabled.
Use Pygments to highlight the syntax.
Smart completion (enabled by default) will prompt context-sensitive completion.
SELECT * FROM <tab> only table names are displayed.
SELECT * FROM users WHERE <tab> only displays the column name.
When the configuration file is started for the first time, it is automatically created in ~ /. Myclirc
Beautiful print table data.
My environment is centos7
First install python-pip
This software package cannot be found when python-pip is installed using yum, so we should install the extended source first.
Sudo yum-y install epel-release
Then install python-pip
Sudo yum-y install python-pip
Clear cache
Sudo yum clean all
Now that python-pip is installed, you can install mycli.
Pip install mycli
Some may encounter the following errors during installation.
This is because the python-devel package is not installed.
Yum install python-devel
Then install MyCli.