CentOS 7.0 下RPM方式安装MySQL5.5.48
环境是CentOS7.0,更新了yum源,之后先是尝试安装了MySQL5.7,但是折腾了一下午没有解决初始密码的问题。项目进度很紧,索性推倒重来上MySQL5.7。今天总算装好了。以下是基本步骤:(可以跳过卸载这一步)
1.卸载原mysql
1 #列出安装的mysql 2 rpm -qa | grep mysql
1 #干掉列出的items 2 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_64 3 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/mysql cd /usr/local/src/mysql wget 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.i686 2 yum -y install libncurses.so.5 3 yum -y install libaio.so.1 4 yum -y install libz.so.1
安装完毕再次尝试安装MySQL5.5,这次没问题了:
1 rpm -ivh MySQL-server-5.5.48-1.linux2.6.i386.rpm 2 rpm -ivh MySQL-devel-5.5.48-1.linux2.6.i386.rpm 3 rpm -ivh MySQL-client-5.5.48-1.linux2.6.i386.rpm 4 rpm -ivh mysql57-community-release-el7-7.noarch.rpm 5 #以下并不必须 6 rpm -ivh MySQL-embedded-5.5.48-1.linux2.6.i386.rpm 7 rpm -ivh MySQL-shared-5.5.48-1.linux2.6.i386.rpm 8 rpm -ivh MySQL-shared-compat-5.5.48-1.linux2.6.i386.rpm 9 rpm -ivh MySQL-test-5.5.48-1.linux2.6.i386.rpm
启动:
service mysql start
这里我遇到一个问题,似乎是还有原来的mysql进程没有杀干净,我使用了ps -ef | grep mysql,然后kill -9 了列出的进程,就启动成功了。
测试:
perfect!!