MySQL命令自动补全工具——mycli安装

1、基于python安装pip
[ ~]# yum -y install python-pip python-devel
[ ~]# crul https://bootstrap.pypa.io/get-pip.py -o get-pip.py
[ ~]# python get-pip.py           # 使用此命令出现黄字或类似字样出现不要担心,不是报错,只是警告您现在Python版本比较低为2.7

安装完毕Python后,你以为直接运行 pip install mycli 就可以完成安装mycli

[ ~]# pip install mycli          # 直接输入此命令则会报如下错误(有些省略了)
 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、接着,出现如上报错我们需要将安装命令更改为:

[ ~]# pip install --ignore-installed mycli

会有大概率能够成功安装,然而事情并没有那么简单,刚执行完毕安装mycli,都显示successfully成功安装,当我使用mycli -uroot -p123 进行登录数据库时,悲催的我又报错了(大哭、大哭)

[ ~]# 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

这个报错是因为缺少一些Python的依赖包而导致的找不到文件,可以通过yum来进行安装

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

忙活儿了半天,这会总该没错了吧,嘿嘿
3、自信登录

[ ~]# mycli -uroot -p123        # 以下为提示信息
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

可以看到下图中可自行上下键选择下来所使用的命令,可使用tab键补全
MySQL命令自动补全工具——mycli安装