MySQL5.7安装mycli

安装该命令尽可能使用普通用户 或 python的虚拟环境,因为使用root安装会破坏python环境(安装时会有提示),python环境直接影响的有yum,也就是说python环境一出问题yum就用不了,特别强调这个

[root@node1 ~]# useradd zhangsan && echo 'aaaaaa' | passwd --stdin zhangsan
[root@node1 ~]# echo 'zhangsan    ALL=(ALL)    NOPASSWD: ALL' >> /etc/sudoers.d/zhangsan
[root@node1 ~]# su - zhangsan

以下命令都在shangsan用户下进行

## 安装python3.9
sudo yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc libffi-devel

wget https://www.python.org/ftp/python/3.9.7/Python-3.9.7.tgz
tar -zxvf Python-3.9.7.tgz
cd Python-3.9.7
./configure --prefix=/usr/local/python3
sudo make && sudo make install

# 自带是python2.7版本,所以将名字改成了python2.7.5,这2步有风险,注意!!!
# mv /usr/bin/python /usr/bin/python2.7.5
# ln -s /usr/local/python3/bin/python3.9  /usr/bin/python

sudo ln -s /usr/local/python3/bin/python3.9  /usr/bin/python3
sudo ln -s /usr/local/python3/bin/pip3  /usr/bin/


# 基于python安装pip
sudo yum -y install python-pip python-devel
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
pip3 install mycli 

[zhangsan@controller ~]$ which mycli
~/.local/bin/mycli

mycli  -u<my_user>  -h<my_host.com>  -p<passwd>

欢迎加入QQ群一起讨论Linux、开源等技术

posted @ 2021-11-04 21:02  Linux大魔王  阅读(139)  评论(0编辑  收藏  举报