说明

这里的方式是通过MYSQL官网下载包进行安装 Mysql 客户端,直接使用yum的安装方式没试过,安装命令yum install mysql-devel

mysql客户端安装

需要在官网上下载4个包,这里以8.0.25版本为例,要下载的包如下:

mysql-community-common
mysql-community-client-plugins
mysql-community-libs
mysql-community-client

主要步骤:

## 查看系统是否已安装 mysql 历史版本
rpm -qa|grep mysql
rpm -qa|grep mariadb
## 如存在 mysql 历史版本可用以下命令,依次进行卸载安装包
yum remove -y mariadb-libs-5.5.68
## 官网下载安装包
wget https://cdn.mysql.com/archives/mysql-8.0/mysql-community-common-8.0.25-1.el7.x86_64.rpm
wget https://cdn.mysql.com/archives/mysql-8.0/mysql-community-client-plugins-8.0.25-1.el7.x86_64.rpm
wget https://cdn.mysql.com/archives/mysql-8.0/mysql-community-libs-8.0.25-1.el7.x86_64.rpm
wget https://cdn.mysql.com/archives/mysql-8.0/mysql-community-client-8.0.25-1.el7.x86_64.rpm
## 依次安装
rpm -ivh mysql-community-common-8.0.25-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-plugins-8.0.25-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.25-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-8.0.25-1.el7.x86_64.rpm
## 验证mysql客户端是否安装成功
mysql --version
mysql  Ver 8.0.25 for Linux on x86_64 (MySQL Community Server - GPL)

参考文档