前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >mysql 添加yum源及选择安装的版本 转

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

作者头像
双面人
发布2019-06-01 14:30:25
1.9K0
发布2019-06-01 14:30:25
举报
文章被收录于专栏:热爱IT

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

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

官方yum源

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

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

安装yum源      

代码语言:javascript
复制
rpm -ivh mysql80-community-release-el7-1.noarch.rpm

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

代码语言:javascript
复制
[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
代码语言:javascript
复制
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]:

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

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

代码语言:javascript
复制
# 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

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

代码语言:javascript
复制
[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]:

(adsbygoogle = window.adsbygoogle || []).push({});

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
云数据库 SQL Server
腾讯云数据库 SQL Server (TencentDB for SQL Server)是业界最常用的商用数据库之一,对基于 Windows 架构的应用程序具有完美的支持。TencentDB for SQL Server 拥有微软正版授权,可持续为用户提供最新的功能,避免未授权使用软件的风险。具有即开即用、稳定可靠、安全运行、弹性扩缩等特点。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档