日期:2014-05-16  浏览次数:20710 次

用Yum安装最新的MySQL版本

用Yum安装最新的MySQL版本

作者:chszs,转载需注明。博客主页:http://blog.csdn.net/chszs

通常在使用Yum安装MySQL时,默认安装的是伴随OS发布的旧MySQL版本。

要安装最新的MySQL版本,你必须去Oracle的MySQL主页,下载最新的发布版本,然后再安装。

现在我们不必那么麻烦了,YUM库里面已经有了最新的MySQL版本。

使用Yum,现在你总是可以安装最新的MySQL社区GA版,还有Workbench和驱动连接器Connector。

怎样安装呢?

只需两步:

1、使用RPM包

从 dev.mysql.com/downloads/repo/下载最新的RPM包并安装。

wget http://dev.mysql.com/get/mysql-community-release-el6-3.noarch.rpm/from/http://repo.mysql.com/
sudo yum localinstall -y mysql-community-release-el6-3.noarch.rpm

2、手动把文件添加到 /etc/yum.repos.d/目录

把以下的内容添加到mysql-community.repo文件中:

[mysql-community]
name=MySQL Community Server 
baseurl=URL
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

根据自己的OS版本,替换适合的baseurl=URL内容:

1)对于EL6 (Centos6 / Redhat 6)

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

2)对于Fedore 18 and 19:

baseurl=http://repo.mysql.com/yum/mysql-community/fc/$releasever/$basearch/

注意:gpgcheck=1,这表示我们需要添加GnuPG key

详情见:http://dev.mysql.com/doc/refman/5.6/en/checking-gpg-signature.html


3、安装包

现在我们使用Yum命令即可安装最新版的MySQL Community Server

yum install mysql-server

4、列出有效的包

要列出Yum仓库中有效的包,可以使用下面的命令:

sudo yum --disablerepo=\* --enablerepo=mysql-community list available
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Available Packages
mysql-community-client.x86_64                                                  5.6.14-3.el6                                             mysql-community
mysql-community-common.i686                                                 5.6.14-3.el6                                             mysql-community
mysql-community-common.x86_64                                            5.6.14-3.el6                                             mysql-community
mysql-community-devel.i686                                                      5.6.14-3.el6                                             mysql-community
mysql-community-devel.x86_64                                                 5.6.14-3.el6                                             mysql-community
mysql-community-embedded.i686                                              5.6.14-3.el6                                             mysql-community
mysql-community-embedded.x86_64                                         5.6.14-3.el6                                             mysql-community
mysql-community-embedded-devel.i686                                    5.6.14-3.el6                                             mysql-community
mysql-community-embedded-devel.x86_64                               5.6.14-3.el6                                             mysql-community
mysql-community-libs.i686                                                        5.6.14-3.el6                                             mysql-community
mysql-community-libs.x86_64                                                   5.6.14-3.el6                                             mysql-community
mysql-community-libs-compat.i686                                          5.6.14-3.el6                                             mysql-community
mysql-community-libs-compat.x86_64                                     5.6.14-3.el6                                             mysql-community
mysql-community-server.x86_64                                              5.6.14-3.el6                                             mysql-community
mysql-community-test.x86_64                                                  5.6.14-3.el6