一、基於python安裝pippython
[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 # 使用此命令出現黃字或相似字樣出現不要擔憂,不是報錯,只是警告您如今Python版本比較低爲2.7
安裝完畢Python後,你覺得直接運行 pip install mycli 就能夠完成安裝myclimysql
[root@mysql ~]# 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.
二、接着,出現如上報錯咱們須要將安裝命令更改成:git
[root@mysql ~]# pip install --ignore-installed mycli
會有大機率可以成功安裝,然而事情並無那麼簡單,剛執行完畢安裝mycli,都顯示successfully成功安裝,當我使用mycli -uroot -p123 進行登陸數據庫時,悲催的我又報錯了(大哭、大哭)
sql
[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
這個報錯是由於缺乏一些Python的依賴包而致使的找不到文件,能夠經過yum來進行安裝數據庫
[root@mysql ~]# yum -y install gcc libffi-devel python-devel openssl-devel && pip install mycli==1.8.1
忙活兒了半天,這會總該沒錯了吧,嘿嘿
三、自信登陸bootstrap
[root@mysql ~]# 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鍵補全
python2.7