next up previous contents
Next: mycli 命令 Up: MyCLI Previous: 前言   Contents   DYWANG_HOME

安裝

  1. CentOS 8 可以使用 python 2.X 或 3.6,安裝提供 pip-3.6 命令工具的 python3-pip 套件。
    [root@kvm8 ~]# yum install python3-pip
    
  2. 使用 pip-3.6 命令工具安裝 mycli。
    [root@kvm8 ~]# pip3.6 install mycli
    WARNING: Running pip install with root privileges is generally not a good idea. 
    Try `pip3.6 install --user` instead.
    Collecting mycli
      Downloading https://files.pythonhosted.org/packages/52/12/
    ..../mycli-1.20.1-py2.py3-none-any.whl (56kB)
        100% |████████████████████████████████| 61kB 193kB/s 
    Collecting cli-helpers[styles]>1.1.0 (from mycli)
      Downloading https://files.pythonhosted.org/packages/51/53/
    ..../cli_helpers-1.2.1-py3-none-any.whl
    Collecting prompt-toolkit>=2.0.6 (from mycli)
      Downloading https://files.pythonhosted.org/packages/7f/1f/
    ..../prompt_toolkit-3.0.2-py3-none-any.whl (344kB)
        100% |████████████████████████████████| 348kB 1.1MB/s 
    Collecting click>=7.0 (from mycli)
      Downloading https://files.pythonhosted.org/packages/fa/37/
    ..../Click-7.0-py2.py3-none-any.whl (81kB)
        100% |████████████████████████████████| 81kB 3.2MB/s 
    Collecting PyMySQL>=0.9.2 (from mycli)
      Downloading https://files.pythonhosted.org/packages/ed/39/
    ..../PyMySQL-0.9.3-py2.py3-none-any.whl (47kB)
        100% |████████████████████████████████| 51kB 4.4MB/s 
    Collecting Pygments>=1.6 (from mycli)
      Downloading https://files.pythonhosted.org/packages/be/39/
    ..../Pygments-2.5.2-py2.py3-none-any.whl (896kB)
        100% |████████████████████████████████| 901kB 611kB/s 
    Requirement already satisfied: configobj>=5.0.5 in
     /usr/lib/python3.6/site-packages (from mycli)
    Requirement already satisfied: cryptography>=1.0.0 in
     /usr/lib64/python3.6/site-packages (from mycli)
    Collecting sqlparse<0.4.0,>=0.3.0 (from mycli)
      Downloading https://files.pythonhosted.org/packages/ef/53/
    ..../sqlparse-0.3.0-py2.py3-none-any.whl
    Collecting tabulate[widechars]>=0.8.2 (from cli-helpers[styles]>1.1.0->mycli)
      Downloading https://files.pythonhosted.org/packages/c4/41/
    ..../tabulate-0.8.6.tar.gz (45kB)
        100% |████████████████████████████████| 51kB 4.9MB/s 
    Collecting terminaltables>=3.0.0 (from cli-helpers[styles]>1.1.0->mycli)
      Downloading https://files.pythonhosted.org/packages/9b/c4/
    ..../terminaltables-3.1.0.tar.gz
    Collecting wcwidth (from prompt-toolkit>=2.0.6->mycli)
      Downloading https://files.pythonhosted.org/packages/58/b4/
    ..../wcwidth-0.1.8-py2.py3-none-any.whl
    Requirement already satisfied: idna>=2.1 in
     /usr/lib/python3.6/site-packages (from cryptography>=1.0.0->mycli)
    Requirement already satisfied: asn1crypto>=0.21.0 in
     /usr/lib/python3.6/site-packages (from cryptography>=1.0.0->mycli)
    Requirement already satisfied: six>=1.4.1 in
     /usr/lib/python3.6/site-packages (from cryptography>=1.0.0->mycli)
    Requirement already satisfied: cffi!=1.11.3,>=1.7 in
     /usr/lib64/python3.6/site-packages (from cryptography>=1.0.0->mycli)
    Requirement already satisfied: pycparser in /usr/lib/python3.6/site-packages 
    (from cffi!=1.11.3,>=1.7->cryptography>=1.0.0->mycli)
    Installing collected packages: wcwidth, tabulate, terminaltables, Pygments, 
    cli-helpers, prompt-toolkit, click, PyMySQL, sqlparse, mycli
      Running setup.py install for tabulate ... done
      Running setup.py install for terminaltables ... done
    Successfully installed PyMySQL-0.9.3 Pygments-2.5.2 cli-helpers-1.2.1 click-7.0 
    mycli-1.20.1 prompt-toolkit-3.0.2 sqlparse-0.3.0 tabulate-0.8.6 terminaltables-3.1.0 wcwidth-0.1.8
    
  3. 執行 easy_install-3.6 安裝 mycli。
    [root@kvm8 ~]# easy_install-3.6 mycli
    Searching for mycli
    Best match: mycli 1.20.1
    Adding mycli 1.20.1 to easy-install.pth file
    Installing mycli script to /usr/local/bin
    
    Using /usr/local/lib/python3.6/site-packages
    Processing dependencies for mycli
    Finished processing dependencies for mycli
    
  4. 使用 mycli 登入 mysql。
    [root@kvm8 ~]# mycli -S /var/lib/mysql/mysql.sock -uroot -p123qwe
    mariadb 10.3.11-MariaDB
    mycli 1.20.1
    Chat: https://gitter.im/dbcli/mycli
    Mail: https://groups.google.com/forum/#!forum/mycli-users
    Home: http://mycli.net
    Thanks to the contributor - jweiland.net
    mariadb root@localhost:(none)> sh 
                                      share  
                                      show
    



De-Yu Wang 2020-04-07