MySQL command auto completion tool -- mycli installation

Keywords: MySQL pip Python yum

1. Install pip based on python

[root@mysql ~]# yum -y install python-pip python-devel
[root@mysql ~]# crul https://bootstrap.pypa.io/get-pip.py -o get-pip.py
[root@mysql ~]# python get-pip.py           # Don't worry if yellow words or similar words appear in this command. It's not an error. It's just a warning that Python version is lower than 2.7

After installing Python, you think you can install mycli by running pip install mycli directly

[root@mysql ~]# pip install mycli          # If you enter this command directly, the following error will be reported (some are omitted)
 Found existing installation: configobj 4.7.2
ERROR: Cannot uninstall 'configobj'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

2. Then, if an error is reported, we need to change the installation command to:

[root@mysql ~]# pip install --ignore-installed mycli

There will be a high probability of successful installation, but things are not so simple. Just after the execution of the installation of mycli, it shows that the installation is successful. When I use mycli-uroot-p123 to log in to the database, I am sorry to report an error again (crying, crying)

[root@mysql ~]# mycli -uroot -p123
Traceback (most recent call last):
  File "/usr/bin/mycli", line 5, in <module>
    from mycli.main import cli
  File "/usr/lib/python2.7/site-packages/mycli/main.py", line 44, in <module>
    from .config import (write_default_config, get_mylogin_cnf_path,
  File "/usr/lib/python2.7/site-packages/mycli/config.py", line 28
    print(message, file=sys.stderr)
                       ^
SyntaxError: invalid syntax

This error report is caused by the lack of some Python dependency packages. You can install it through yum

[root@mysql ~]# yum -y install gcc libffi-devel python-devel openssl-devel &&  pip install mycli==1.8.1

I've been busy working for a long time. This meeting must be right, hehe
3. Confident login

[root@mysql ~]# mycli -uroot -p123        # Here are the tips
Version: 1.8.1
Chat: https://gitter.im/dbcli/mycli
Mail: https://groups.google.com/forum/#!forum/mycli-users
Home: http://mycli.net
Thanks to the contributor - Nathan Taggart

You can see the commands you can select by pressing up and down in the figure below, and you can use tab to complete them

Posted by drak on Tue, 05 May 2020 00:43:02 -0700