[[email protected] ~]# rpm -qa | grep yum
yum-plugin-fastestmirror-1.1.31-45.el7.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-langpacks-0.4.2-7.el7.noarch
yum-utils-1.1.31-45.el7.noarch
yum-3.4.3-158.el7.centos.noarch
[[email protected] ~]# cd /etc/yum.repos.d/
[[email protected] yum.repos.d]# ls
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo
[[email protected] yum.repos.d]# vi CentOS-Base.repo
[[email protected] yum.repos.d]# rm -rf *.repo
[[email protected] yum.repos.d]# ls
[[email protected] yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
--2018-06-06 10:25:58-- http://mirrors.163.com/.help/CentOS7-Base-163.repo
正在解析主机 mirrors.163.com (mirrors.163.com)... 59.111.0.251
正在连接 mirrors.163.com (mirrors.163.com)|59.111.0.251|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:1572 (1.5K) [application/octet-stream]
正在保存至: “CentOS7-Base-163.repo”
100%[======================================>] 1,572 --.-K/s 用时 0s
2018-06-06 10:25:58 (138 MB/s) - 已保存 “CentOS7-Base-163.repo” [1572/1572])
[[email protected] yum.repos.d]# ls
CentOS7-Base-163.repo
[[email protected] yum.repos.d]# yum clean all
已加载插件:fastestmirror, langpacks
正在清理软件源: base extras updates
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned d ata from disabled or removed repos
[[email protected] yum.repos.d]# cp CentOS7-Base-163.repo CentOS7-Base-163.repo.bak
[[email protected] yum.repos.d]# vi CentOS7-Base-163.repo
[[email protected] yum.repos.d]# cat /etc/centos-release
CentOS Linux release 7.5.1804 (Core)
[[email protected] yum.repos.d]# yum install mysql-server
已加载插件:fastestmirror, langpacks
Determining fastest mirrors
base | 3.6 kB 00:00
extras | 3.4 kB 00:00
updates | 3.4 kB 00:00
(1/4): base/x86_64/group_gz | 166 kB 00:00
(2/4): updates/x86_64/primary_db | 2.0 MB 00:01
(3/4): base/x86_64/primary_db | 5.9 MB 00:04
(4/4): extras/x86_64/primary_db | 147 kB 00:10
没有可用软件包 mysql-server。
错误:无须任何处理
[[email protected] yum.repos.d]# yum -y install wget
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
软件包 wget-1.14-15.el7_4.1.x86_64 已安装并且是最新版本
无须任何处理
[[email protected] yum.repos.d]# cd /home
[[email protected] home]# ls
[[email protected] home]# mkdir linshi
c[[email protected] home]# cd linshi/
[[email protected] linshi]# wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
--2018-06-06 10:38:42-- http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
正在解析主机 repo.mysql.com (repo.mysql.com)... 23.195.78.58
正在连接 repo.mysql.com (repo.mysql.com)|23.195.78.58|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:6140 (6.0K) [application/x-redhat-package-manager]
正在保存至: “mysql-community-release-el7-5.noarch.rpm”
100%[======================================>] 6,140 --.-K/s 用时 0s
2018-06-06 10:38:42 (500 MB/s) - 已保存 “mysql-community-release-el7-5.noarch.rp m” [6140/6140])
[[email protected] linshi]# rpm -ivh mysql-community-release-el7-5.noarch.rpm
准备中... ################################# [100%]
正在升级/安装...
1:mysql-community-release-el7-5 ################################# [100%]
[[email protected] linshi]# ls /etc/yum.repos.d/
CentOS7-Base-163.repo mysql-community.repo
CentOS7-Base-163.repo.bak mysql-community-source.repo
[[email protected] linshi]# yum install mysql-server
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
mysql-connectors-community | 2.5 kB 00:00
mysql-tools-community | 2.5 kB 00:00
mysql56-community | 2.5 kB 00:00
(1/3): mysql-connectors-community/x86_64/primary_db | 20 kB 00:00
(2/3): mysql-tools-community/x86_64/primary_db | 41 kB 00:00
(3/3): mysql56-community/x86_64/primary_db | 191 kB 00:01
正在解决依赖关系
--> 正在检查事务
---> 软件包 mysql-community-server.x86_64.0.5.6.40-2.el7 将被 安装
--> 正在处理依赖关系 mysql-community-common(x86-64) = 5.6.40-2.el7,它被软件包 m ysql-community-server-5.6.40-2.el7.x86_64 需要
--> 正在处理依赖关系 mysql-community-client(x86-64) >= 5.6.10,它被软件包 mysql- community-server-5.6.40-2.el7.x86_64 需要
--> 正在处理依赖关系 perl(DBI),它被软件包 mysql-community-server-5.6.40-2.el7.x 86_64 需要
--> 正在检查事务
---> 软件包 mysql-community-client.x86_64.0.5.6.40-2.el7 将被 安装
--> 正在处理依赖关系 mysql-community-libs(x86-64) >= 5.6.10,它被软件包 mysql-co mmunity-client-5.6.40-2.el7.x86_64 需要
---> 软件包 mysql-community-common.x86_64.0.5.6.40-2.el7 将被 安装
---> 软件包 perl-DBI.x86_64.0.1.627-4.el7 将被 安装
--> 正在处理依赖关系 perl(RPC::PlServer) >= 0.2001,它被软件包 perl-DBI-1.627-4. el7.x86_64 需要
--> 正在处理依赖关系 perl(RPC::PlClient) >= 0.2000,它被软件包 perl-DBI-1.627-4. el7.x86_64 需要
--> 正在检查事务
---> 软件包 mariadb-libs.x86_64.1.5.5.56-2.el7 将被 取代
---> 软件包 mysql-community-libs.x86_64.0.5.6.40-2.el7 将被 舍弃
---> 软件包 perl-PlRPC.noarch.0.0.2020-14.el7 将被 安装
--> 正在处理依赖关系 perl(Net::Daemon) >= 0.13,它被软件包 perl-PlRPC-0.2020-14. el7.noarch 需要
--> 正在处理依赖关系 perl(Net::Daemon::Test),它被软件包 perl-PlRPC-0.2020-14.el 7.noarch 需要
--> 正在处理依赖关系 perl(Net::Daemon::Log),它被软件包 perl-PlRPC-0.2020-14.el7 .noarch 需要
--> 正在检查事务
---> 软件包 perl-Net-Daemon.noarch.0.0.48-5.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
================================================================================
Package 架构 版本 源 大小
================================================================================
正在安装:
mysql-community-libs x86_64 5.6.40-2.el7 mysql56-community 2.0 M
替换 mariadb-libs.x86_64 1:5.5.56-2.el7
mysql-community-server x86_64 5.6.40-2.el7 mysql56-community 59 M
为依赖而安装:
mysql-community-client x86_64 5.6.40-2.el7 mysql56-community 19 M
mysql-community-common x86_64 5.6.40-2.el7 mysql56-community 257 k
perl-DBI x86_64 1.627-4.el7 base 802 k
perl-Net-Daemon noarch 0.48-5.el7 base 51 k
perl-PlRPC noarch 0.2020-14.el7 base 36 k
事务概要
================================================================================
安装 2 软件包 (+5 依赖软件包)
总下载量:82 M
Is this ok [y/d/N]: y
Downloading packages:
警告:/var/cache/yum/x86_64/7/mysql56-community/packages/mysql-community-common- 5.6.40-2.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
mysql-community-common-5.6.40-2.el7.x86_64.rpm 的公钥尚未安装
(1/7): mysql-community-common-5.6.40-2.el7.x86_64.rpm | 257 kB 00:01
(2/7): mysql-community-libs-5.6.40-2.el7.x86_64.rpm | 2.0 MB 00:00
警告:/var/cache/yum/x86_64/7/base/packages/perl-Net-Daemon-0.48-5.el7.noarch.rp m: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
perl-Net-Daemon-0.48-5.el7.noarch.rpm 的公钥尚未安装
(3/7): perl-Net-Daemon-0.48-5.el7.noarch.rpm | 51 kB 00:00
(4/7): perl-PlRPC-0.2020-14.el7.noarch.rpm | 36 kB 00:00
(5/7): perl-DBI-1.627-4.el7.x86_64.rpm | 802 kB 00:00
(6/7): mysql-community-client-5.6.40-2.el7.x86_64.rpm | 19 MB 00:08
(7/7): mysql-community-server-5.6.40-2.el7.x86_64.rpm | 59 MB 00:19
--------------------------------------------------------------------------------
总计 3.7 MB/s | 82 MB 00:21
从 http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 检索密钥
导入 GPG key 0xF4A80EB5:
用户ID : "CentOS-7 Key (CentOS 7 Official Signing Key) <[email protected] >"
指纹 : 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
来自 : http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
是否继续?[y/N]:y
从 file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql 检索密钥
导入 GPG key 0x5072E1F5:
用户ID : "MySQL Release Engineering <[email protected]>"
指纹 : a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5
软件包 : mysql-community-release-el7-5.noarch (installed)
来自 : file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
是否继续?[y/N]:y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
警告:RPM 数据库已被非 yum 程序修改。
正在安装 : mysql-community-common-5.6.40-2.el7.x86_64 1/8
正在安装 : mysql-community-libs-5.6.40-2.el7.x86_64 2/8
正在安装 : mysql-community-client-5.6.40-2.el7.x86_64 3/8
正在安装 : perl-Net-Daemon-0.48-5.el7.noarch 4/8
正在安装 : perl-PlRPC-0.2020-14.el7.noarch 5/8
正在安装 : perl-DBI-1.627-4.el7.x86_64 6/8
正在安装 : mysql-community-server-5.6.40-2.el7.x86_64 7/8
正在删除 : 1:mariadb-libs-5.5.56-2.el7.x86_64 8/8
验证中 : perl-Net-Daemon-0.48-5.el7.noarch 1/8
验证中 : mysql-community-server-5.6.40-2.el7.x86_64 2/8
验证中 : perl-PlRPC-0.2020-14.el7.noarch 3/8
验证中 : mysql-community-client-5.6.40-2.el7.x86_64 4/8
验证中 : mysql-community-libs-5.6.40-2.el7.x86_64 5/8
验证中 : mysql-community-common-5.6.40-2.el7.x86_64 6/8
验证中 : perl-DBI-1.627-4.el7.x86_64 7/8
验证中 : 1:mariadb-libs-5.5.56-2.el7.x86_64 8/8
已安装:
mysql-community-libs.x86_64 0:5.6.40-2.el7 mysql-community-server.x86_64 0:5.6.40-2.el7
作为依赖被安装:
mysql-community-client.x86_64 0:5.6.40-2.el7
mysql-community-common.x86_64 0:5.6.40-2.el7
perl-DBI.x86_64 0:1.627-4.el7
perl-Net-Daemon.noarch 0:0.48-5.el7
perl-PlRPC.noarch 0:0.2020-14.el7
替代:
mariadb-libs.x86_64 1:5.5.56-2.el7
完毕!
[[email protected] linshi]# systemctl start mysqld
[[email protected] linshi]# systemctl status mysqld
[[email protected] linshi]# systemctl enable mysqld
原文地址:http://blog.51cto.com/jiangjieshi/2125437