epel源mysql版本_mysql 添加yum源及选择安装的版本

本文介绍了如何在CentOS系统中通过YUM安装MySQL,包括从官方源下载YUM配置文件,安装指定版本的MySQL,以及如何修改YUM源以选择5.6版本。详细步骤包括启用不同版本的MySQL源并展示安装过程。
摘要由CSDN通过智能技术生成

从centos6开始,官方版本的yum源中用mariadb替换了mysql,那么安装mysql一般需要去官网下载rpm包或者源码包等方式。

如果还想直接yum安装的话需要自己配置mysql的yum源。

官方yum源

https://dev.mysql.com/downloads/repo/yum/

下载对应版本mysql源到本地,如果系统是centos7,这里选择el7版本

8c86c6208bcab007771a9d76802ac9cc.png

安装yum源

rpm -ivh mysql80-community-release-el7-1.noarch.rpm

查看mysql yum源,yum install mysql  默认安装的是8.0版本

[root@linux-node yum.repos.d]# yum repolist|grep mysql

mysql-connectors-community/x86_64 MySQL Connectors Community 74

mysql-tools-community/x86_64 MySQL Tools Community 74

mysql55-community/x86_64 MySQL 5.5 Community Server 427

mysql56-community/x86_64 MySQL 5.6 Community Server 429

mysql80-community/x86_64 MySQL 8.0 Community Server 49

48304ba5e6f9fe08f3fa1abda7d326ab.png

Dependencies Resolved

==================================================================================================================================================================================================================

Package Arch Version Repository Size

==================================================================================================================================================================================================================

Installing:

mysql-community-client x86_64 8.0.13-1.el7 mysql80-community 26 M

mysql-community-libs x86_64 8.0.13-1.el7 mysql80-community 2.3 M

replacing mariadb-libs.x86_64 1:5.5.56-2.el7

mysql-community-libs-compat x86_64 8.0.13-1.el7 mysql80-community 2.1 M

replacing mariadb-libs.x86_64 1:5.5.56-2.el7

Installing for dependencies:

mysql-community-common x86_64 8.0.13-1.el7 mysql80-community 554 k

Updating for dependencies:

postfix x86_64 2:2.10.1-7.el7 base 2.4 M

Transaction Summary

==================================================================================================================================================================================================================

Install 3 Packages (+1 Dependent package)

Upgrade ( 1 Dependent package)

Total download size: 33 M

Is this ok [y/d/N]:

48304ba5e6f9fe08f3fa1abda7d326ab.png

要修改默认安装版本的话,可以直接修改mysql的yum源文件,yum配置文件里从5.5版本到8.0都有,只不过默认只开启了mysql8.0。更改别的版本记得将mysql8.0的源 enable=0

vim /etc/yum.repos.d/mysql-community.repo

48304ba5e6f9fe08f3fa1abda7d326ab.png

# Enable to use MySQL 5.6

[mysql56-community]

name=MySQL 5.6 Community Server

baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/7/$basearch/

enabled=1 #打开mysql5.6源

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

48304ba5e6f9fe08f3fa1abda7d326ab.png

再yum  install看一下,默认已经是mysql5.6了

48304ba5e6f9fe08f3fa1abda7d326ab.png

[root@linux-node2 yum.repos.d]# yum install mysql

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

* base: mirrors.aliyun.com

* epel: mirrors.aliyun.com

* extras: mirrors.aliyun.com

* updates: mirrors.aliyun.com

Resolving Dependencies

--> Running transaction check

---> Package mysql-community-client.x86_64 0:5.6.42-2.el7 will be installed

--> Processing Dependency: mysql-community-libs(x86-64) >= 5.6.10 for package: mysql-community-client-5.6.42-2.el7.x86_64

--> Running transaction check

---> Package mariadb-libs.x86_64 1:5.5.56-2.el7 will be obsoleted

---> Package mysql-community-libs.x86_64 0:5.6.42-2.el7 will be obsoleting

--> Processing Dependency: mysql-community-common(x86-64) >= 5.6.10 for package: mysql-community-libs-5.6.42-2.el7.x86_64

--> Running transaction check

---> Package mysql-community-common.x86_64 0:5.6.42-2.el7 will be installed

--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================================================================================================

Package Arch Version Repository Size

==================================================================================================================================================================================================================

Installing:

mysql-community-client x86_64 5.6.42-2.el7 mysql56-community 20 M

mysql-community-libs x86_64 5.6.42-2.el7 mysql56-community 2.0 M

replacing mariadb-libs.x86_64 1:5.5.56-2.el7

Installing for dependencies:

mysql-community-common x86_64 5.6.42-2.el7 mysql56-community 257 k

Transaction Summary

==================================================================================================================================================================================================================

Install 2 Packages (+1 Dependent package)

Total download size: 22 M

Is this ok [y/d/N]:

48304ba5e6f9fe08f3fa1abda7d326ab.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值