安裝於 CentOS 7

  1. CentOS 7.x 預設使用 python 2.7,支援 MyCLI 1.9 安裝,但 python2-pip 套件在 epel-releases repository,所以必須先安裝 epel-release 套件。
    [root@kvm5 ~]# yum install epel-release.noarch
    
  2. python2-pip 套件提供 pip 命令工具,先將其安裝起來。
    [root@kvm5 ~]# yum install python2-pip
    
  3. 使用 pip 命令工具安裝 mycli。
    [root@kvm5 ~]# pip install mycli
    Collecting mycli
      Downloading https://files.pythonhosted.org/packages/.../0-py2.py3-none-any.whl (56kB)
        100% |████████████████████████████████| 61kB 190kB/s 
    ........
    Successfully installed PyMySQL-0.9.3 Pygments-2.4.0 .........
    You are using pip version 8.1.2, however version 19.1.1 is available.
    You should consider upgrading via the 'pip install --upgrade pip' command.
    [root@kvm5 ~]#
    
  4. 必須先 upgrade pip。
    [root@kvm5 ~]# pip install --upgrade pip
    Collecting pip
      Downloading https://files.pythonhosted.org/packages/...
    /pip-19.1.1-py2.py3-none-any.whl (1.4MB)
        100% |████████████████████████████████| 1.4MB 1.1MB/s 
    Installing collected packages: pip
      Found existing installation: pip 8.1.2
        Uninstalling pip-8.1.2:
          Successfully uninstalled pip-8.1.2
    Successfully installed pip-19.1.1
    
  5. 再執行 pip 安裝 mycli。
    [root@kvm5 ~]# pip install mycli
    
  6. 執行 easy_install 安裝 mycli。
    [root@kvm5 ~]# easy_install mycli
    Searching for mycli
    Best match: mycli 1.19.0
    Adding mycli 1.19.0 to easy-install.pth file
    Installing mycli script to /usr/bin
    
    Using /usr/lib/python2.7/site-packages
    Processing dependencies for mycli
    Finished processing dependencies for mycli
    
  7. 使用 mycli 登入 mysql。
    [root@kvm5 ~]# mycli -S /var/lib/mysql/mysql.sock -uroot -p123qwe
    mariadb 5.5.56-MariaDB
    mycli 1.19.0
    Chat: https://gitter.im/dbcli/mycli
    Mail: https://groups.google.com/forum/#!forum/mycli-users
    Home: http://mycli.net
    Thanks to the contributor - Scrappy Soft
    mariadb root@localhost:(none)>