CentOS 7.0 下RPM方式安裝MySQL5.5.48
環境是CentOS7.0,更新了yum源,之後先是嘗試安裝了MySQL5.7,但是折騰了一下午沒有解決初始密碼的問題。項目進度很緊,索性推倒重來上MySQL5.7。今天總算裝好了。以下是基本步驟:(可以跳過卸載這一步)
1.卸載原mysql
1 #列出安裝的mysql2 rpm -qa | grep mysql
1 #幹掉列出的items2 rpm -e [item1]3 rpm -e [item2]4 rpm -e [item3]
由於5.7基於mariadb,所以還必須卸掉它:
1 #列出2 rpm -qa | grep mariadb
1 #卸載2 rpm -e mariadb-devel-5.5.44-2.el7.centos.x86_643 rpm -e mariadb-libs-5.5.44-2.el7.centos.x86_64
刪除相關檔案夾
find / -name mysql#將列出的檔案夾一一刪除。
2.下載MySQL(RPM Bundle)
地址不一定存在,所以去官網複製一下比較保險,官網找到MySQL Community Server,platform我選的是Linux-Generic.
注意要選這個RPM Bundle,其他版本是編譯安裝的,只有帶RPM Bundle的是RPM合集包。點Dowlaod去下一頁:
複製這個 No thanks 的連結地址就是我們需要的連結地址。
3.安裝MySQL5.5.48
回到linux,使用剛才複製的地址:
mkdir /usr/local/src/mysqlcd /usr/local/src/mysqlwget http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-5.5.48-1.linux2.6.x86_64.rpm-bundle.tar
下載完畢,tar -xf MySQL-5.5.48-1.linux2.6.x86_64.rpm-bundle.tar
ls 應該能看到如下:
需要依次安裝 client devel server (community-release我也裝了)
安裝的時候有幾次報錯如下:
error: Failed dependencies: libc.so.6 is needed by MySQL-client-5.5.48-1.linux2.6.i386 libc.so.6(GLIBC_2.0) is needed by MySQL-client-5.5.48-1.linux2.6.i386 libc.so.6(GLIBC_2.1) is needed by MySQL-client-5.5.48-1.linux2.6.i386 libc.so.6(GLIBC_2.1.3) is needed by MySQL-client-5.5.48-1.linux2.6.i386 libc.so.6(GLIBC_2.2) is needed by MySQL-client-5.5.48-1.linux2.6.i386 libc.so.6(GLIBC_2.3) is needed by MySQL-client-5.5.48-1.linux2.6.i386 libdl.so.2 is needed by MySQL-client-5.5.48-1.linux2.6.i386 libdl.so.2(GLIBC_2.0) is needed by MySQL-client-5.5.48-1.linux2.6.i386 libdl.so.2(GLIBC_2.1) is needed by MySQL-client-5.5.48-1.linux2.6.i386 libm.so.6 is needed by MySQL-client-5.5.48-1.linux2.6.i386 libm.so.6(GLIBC_2.0) is needed by MySQL-client-5.5.48-1.linux2.6.i386 libncurses.so.5 is needed by MySQL-client-5.5.48-1.linux2.6.i386 libpthread.so.0 is needed by MySQL-client-5.5.48-1.linux2.6.i386 libpthread.so.0(GLIBC_2.0) is needed by MySQL-client-5.5.48-1.linux2.6.i386 libpthread.so.0(GLIBC_2.1) is needed by MySQL-client-5.5.48-1.linux2.6.i386 libpthread.so.0(GLIBC_2.2) is needed by MySQL-client-5.5.48-1.linux2.6.i386 libpthread.so.0(GLIBC_2.3.2) is needed by MySQL-client-5.5.48-1.linux2.6.i386 librt.so.1 is needed by MySQL-client-5.5.48-1.linux2.6.i386 librt.so.1(GLIBC_2.2) is needed by MySQL-client-5.5.48-1.linux2.6.i386
error: Failed dependencies: libaio.so.1 is needed by MySQL-server-5.5.48-1.linux2.6.i386 libaio.so.1(LIBAIO_0.1) is needed by MySQL-server-5.5.48-1.linux2.6.i386 libaio.so.1(LIBAIO_0.4) is needed by MySQL-server-5.5.48-1.linux2.6.i386
整理了一下,基本上安裝以下幾個依賴(如果yum源沒有這些包)
1 yum -y install glibc.i6862 yum -y install libncurses.so.53 yum -y install libaio.so.14 yum -y install libz.so.1
安裝完畢再次嘗試安裝MySQL5.5,這次沒問題了:
1 rpm -ivh MySQL-server-5.5.48-1.linux2.6.i386.rpm2 rpm -ivh MySQL-devel-5.5.48-1.linux2.6.i386.rpm3 rpm -ivh MySQL-client-5.5.48-1.linux2.6.i386.rpm4 rpm -ivh mysql57-community-release-el7-7.noarch.rpm5 #以下並不必須6 rpm -ivh MySQL-embedded-5.5.48-1.linux2.6.i386.rpm7 rpm -ivh MySQL-shared-5.5.48-1.linux2.6.i386.rpm8 rpm -ivh MySQL-shared-compat-5.5.48-1.linux2.6.i386.rpm9 rpm -ivh MySQL-test-5.5.48-1.linux2.6.i386.rpm
啟動:
service mysql start
這裡我遇到一個問題,似乎是還有原來的mysql進程沒有殺乾淨,我使用了ps -ef | grep mysql,然後kill -9 了列出的進程,就啟動成功了。
測試:
perfect!!
本文永久更新連結地址: