CentOS 安装 Mycli

运维的坑 2016-01-15 01:43 暂无评论

环境:CentOS7 1511 最小化安装

Mycli 是基于 Python 开发的一个终端式的 MySQL 客户端非常好有,自带命令补全。非常赞!!
Mycli for MySQL 增强客户端

因为是最小化的安装,首先添加源安装 Python 的模块 setuptoolspip 如果直接 yum install python-pip 的话,会提示没有这个包,安装会失败。先添加一个扩展源,然后再继续安装!

[root@localhost ~]# yum install epel-release -y
[root@localhost ~]# yum install python-setuptools -y
[root@localhost ~]# yum install python-pip -y
[root@localhost ~]# yum install python-devel -y

安装完基本的包以及pip等相关需要的包和支持就可以直接装 Mycli

[root@localhost ~]# pip install mycli

如果出现以下错误说明没有安装 python-devel 包,安装会失败。

    gcc -pthread -fno-strict-aliasing -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.7 -c src/MD2.c -o build/temp.linux-x86_64-2.7/src/MD2.o
    src/MD2.c:31:20: fatal error: Python.h: No such file or directory
     #include "Python.h"
    compilation terminated.
    error: command 'gcc' failed with exit status 1

Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-vjJjp0/pycrypto/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-wX8qRn-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-vjJjp0/pycrypto


[root@localhost ~]# mycli --help
Usage: mycli [OPTIONS] [DATABASE]

  -h, --host TEXT               Host address of the database.
  -P, --port INTEGER            Port number to use for connection. Honors
  -u, --user TEXT               User name to connect to the database.
  -S, --socket TEXT             The socket file to use for connection.
  -p, --password TEXT           Password to connect to the database
  --pass TEXT                   Password to connect to the database
  -v, --version                 Version of mycli.
  -D, --database TEXT           Database to use.
  -R, --prompt TEXT             Prompt format (Default: "\t \u@\h:\d> ")
  -l, --logfile FILENAME        Log every query and its results to a file.
  --defaults-group-suffix TEXT  Read config group with the specified suffix.
  --defaults-file PATH          Only read default options from the given file
  --login-path TEXT             Read this path from the login file.
  --help                        Show this message and exit.
  1. essayforme

    Cheers. A good amount of info.