说明:
在使用yum安装mysql时,默认安装的是伴随OS发布的旧MySQL版本。
要安装最新的MySQL版本,需要去Oracle的MySQL主页,下载最新的发布版本,然后再安装。
现在YUM库中已有最新的MySQL版本。
使用Yum,现在可以安装最新的MySQL社区GA版,还有Workbench和驱动连接器Connector。
这里分享下具体的yum安装最新版mysql的步骤。
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.i6865.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.i6865.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 mysql-community
mysql-connector-odbc.x86_64 5.2.6-1.el6 mysql-community
mysql-workbench-community.x86_64 6.0.7-4.el6 mysql-community