提前說一下,網速不好不要用yum安裝,等得時間太長。
第一步、獲取yum源
[root@youxi1 ~]# rpm -ivh https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql57-community-release-el7-10.noarch.rpm 獲取https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql57-community-release-el7-10.noarch.rpm 警告:/var/tmp/rpm-tmp.ztTcV0: 頭V3 DSA/SHA1 Signature, 密鑰 ID 5072e1f5: NOKEY 准備中... ################################# [100%] 正在升級/安裝... 1:mysql57-community-release-el7-10 ################################# [100%]
https://repo.mysql.com是可以查看目錄結構的網址,可以根據需求查找需要的mysql源。
第二步、查看yum源
[root@youxi1 ~]# yum list | grep mysql-community-server mysql-community-server.x86_64 5.7.26-1.el7 mysql57-community
第三步、安裝mysql
[root@youxi1 ~]# yum -y install mysql-community-server
使用yum安裝的好處在於,它會自動安裝依賴包,以及替換包(例如CentOS7中的mariadb-libs.x86_64 1:5.5.60-1.el7_5)
之后的配置和rpm安裝是一樣的,詳細請查看:CentOS7使用rpm安裝mysql5.7