你的位置:首页 > 操作系统

[操作系统]RPM方式安装MySQL5.5.48 (Aliyun CentOS 7.0 卸载MySQL5.7)


环境是阿里云的CentOS7.0,更新了yum源(更新yum源请参考https://help.aliyun.com/knowledge_detail/5974184.html)之后先是尝试安装了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源没有这些包,可以尝试更新一下https://help.aliyun.com/knowledge_detail/5974184.html)

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!!

 

dreamingodd原创文章,如转载请注明出处。