https://dev.mysql.com/downloads/mysql/
# centso7 下仅安装客户端 , 选择Rad Hat Enterprise Linux,
首先确认系统是否已经安装了mysql或者mariaDB
rpm -qa | grep mysql
rpm -qa | grep mariaDB
#检查mysql rpm相关的包是否安装并去除
rpm -qa | grep -i mysql
rpm -e --nodeps mariadb-libs-5.5.60-1.el7_5.x86_64 # 卸载
rpm -e mysql-libs-5.1.73-8.el6_8.x86_64
注意:一定要将mariaDB包和自带mysql包卸载干净,否则安装时出现各种奇妙错误,导致失败。
yum remove -y mysql-libs
cd /data/file/soft/src/mysql
yum install -y openssl libncurses.so.5
# MySQL-5.7
rpm -ivh http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-community-common-5.7.43-1.el7.x86_64.rpm
rpm -ivh http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-community-libs-5.7.43-1.el7.x86_64.rpm
rpm -ivh http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-community-client-5.7.43-1.el7.x86_64.rpm
# MySQL-8.0
rpm -hvi https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-community-common-8.0.22-1.el8.x86_64.rpm
rpm -ivh https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-community-client-plugins-8.0.22-1.el8.x86_64.rpm
rpm -ivh https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-community-libs-8.0.22-1.el8.x86_64.rpm
rpm -ivh https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-community-client-8.0.22-1.el7.x86_64.rpm
注意:common先装,libs依赖common,client依赖libs,server依赖common和client。
# debian安装mysql客户端
apt-get update -y
apt-get install -y wget vim net-tools curl git cron axel zip unzip
apt-get install -y cmake golang python
apt-get install -y build-essential autoconf automake libtool
apt-get dist-upgrade -y
apt-get upgrade -y
apt autoremove
apt clean
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
apt-cache search mysql-client
apt-get install -y mariadb-client-10.8
apt-get install -y mysql-client
# centos mariadb
#curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | bash
yum -y install MariaDB-client
vim /etc/yum.repos.d/MariaDB.repo
-默认; http://mirror.mariadb.org/yum/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/yum/11.0/rhel9-amd64/
module_hotfixes=1
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
-国内阿里云; https://mirrors.aliyun.com/mariadb/yum/
[mariadb]
name = MariaDB
baseurl = https://mirrors.aliyun.com/mariadb/yum/10.8/centos8-amd64
module_hotfixes=1
gpgkey=https://mirrors.aliyun.com/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1
yum makecache
yum clean all
dnf install -y MariaDB-client
http://yum.mariadb.org/10.8/centos8-amd64/rpms/
#依赖检测失败:mariadb-connector-c-config 被 mysql-community-server-8.0.19-10.fc31.x86_64 取代
yum remove mariadb-connector-c-config -y
# centos mysql
---添加mysql官方的yum源; https://repo.mysql.com/
rpm -ivh https://repo.mysql.com/mysql80-community-release-el8.rpm
rpm -ivh https://repo.mysql.com/mysql80-community-release-el9.rpm
---安装GPG KEY
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
--安装mysql-client
yum -y install mysql-community-client.x86_64
-如果你不想安装GPG KEY的话,可以试试在yum install 版本后面加上 --nogpgcheck,即可绕过GPG验证成功安装,如下:
yum -y install mysql-community-client.x86_64 --nogpgcheck
yum search mysql-community
yum install mysql-community-client.x86_64 -y