通常在使用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
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 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
要注意:對于生産伺服器要先測試、再測試!!!