直接安装:
yum install mysql-community-client
报了错误No package mysql-community-client available.
原因:CentOS/RHEL系统默认的软件源中并不包含MySQL软件包,需要通过添加第三方存储库来获取MySQL相关软件
添加源
安装MySQL官方的Yum存储库配置文件,以便后续可以使用yum来安装mysql软件包。
rpm -ivh http://repo.mysql.com/mysql57-community-release-el7-10.noarch.rpm
Retrieving http://repo.mysql.com/mysql57-community-release-el7-10.noarch.rpm
warning: /var/tmp/rpm-tmp.XH9ojm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...1:mysql57-community-release-el7-10 ################################# [100%]
查看可用的mysql client软件包:
yum info mysql-community-client
再次安装
yum install mysql-community-client
报了错误The GPG keys listed for the "MySQL 5.7 Community Server" repository are already installed but they are not correct for this package.
GPG keys是安装包发布时生成的密钥,安装时需要核对密钥来确保安全性。
我们可以选择禁用它,来跳过检查。
第三次安装
yum -y install mysql-community-client --nogpgcheck
查看mysql版本:
[root@localhost sqlproxy]# mysql --version
mysql Ver 14.14 Distrib 5.7.44, for Linux (x86_64) using EditLine wrapper
mysql-client安装成功。