一:查看下是否有系统自带MysqL的rpm包,如果有,需要删除自带的旧rpm包。
[root@localhostmnt]#MysqL-V MysqLVer14.14Distrib5.1.73,forredhat-linux-gnu(x86_64)usingreadline5.1 [root@localhostmnt]#rpm-qa|grep-iMysqL MysqL-server-5.1.73-8.el6_8.x86_64 MysqL-5.1.73-8.el6_8.x86_64 MysqL-devel-5.1.73-8.el6_8.x86_64 MysqL-libs-5.1.73-8.el6_8.x86_64 perl-DBD-MysqL-4.013-3.el6.x86_64 [root@localhostmnt]#yumremoveMysqL*
二:在MysqL官网下载安装MysqL-5.6.21所需的rpm软件包。
需要下载三个rpm软件包:
MysqL-client-5.6.21-1.rhel5.x86_64.rpm
MysqL-devel-5.6.21-1.rhel5.x86_64.rpm
MysqL-server-5.6.21-1.rhel5.x86_64.rpm
[root@linuxidc/mnt]#wgethttp://dev.MysqL.com/Downloads/MysqL-5.6/MysqL-server-5.6.21-1.rhel5.x86_64.rpm [root@linuxidc/mnt]#wgethttp://dev.MysqL.com/Downloads/MysqL-5.6/MysqL-devel-5.6.21-1.rhel5.x86_64.rpm [root@linuxidc/mnt]#wgethttp://dev.MysqL.com/Downloads/MysqL-5.6/MysqL-client-5.6.21-1.rhel5.x86_64.rpm
报错:
wgethttp://dev.MysqL.com/Downloads/MysqL-5.6/MysqL-server-5.6.21-1.rhel5.x86_64.rpm --2017-09-1417:07:49--http://dev.MysqL.com/Downloads/MysqL-5.6/MysqL-server-5.6.21-1.rhel5.x86_64.rpm 正在解析主机dev.MysqL.com...137.254.60.11 正在连接dev.MysqL.com|137.254.60.11|:80...已连接。 已发出HTTP请求,正在等待回应...301MovedPermanently 位置:https://dev.MysqL.com/Downloads/MysqL-5.6/MysqL-server-5.6.21-1.rhel5.x86_64.rpm[跟随至新的URL] --2017-09-1417:07:50--https://dev.MysqL.com/Downloads/MysqL-5.6/MysqL-server-5.6.21-1.rhel5.x86_64.rpm 正在连接dev.MysqL.com|137.254.60.11|:443...已连接。 错误:证书通用名“www.MysqL.com”与所要求的主机名“dev.MysqL.com”不符。 要以不安全的方式连接至dev.MysqL.com,使用‘--no-check-certificate’。
[root@linuxidc/mnt]#wget--no-check-certificatehttp://dev.MysqL.com/Downloads/MysqL-5.6/MysqL-server-5.6.21-1.rhel5.x86_64.rpm [root@linuxidc/mnt]#wget--no-check-certificatehttp://dev.MysqL.com/Downloads/MysqL-5.6/MysqL-devel-5.6.21-1.rhel5.x86_64.rpm [root@linuxidc/mnt]#wget--no-check-certificatehttp://dev.MysqL.com/Downloads/MysqL-5.6/MysqL-client-5.6.21-1.rhel5.x86_64.rpm
然后安装:
[root@localhost~]#rpm-ivhMysqL-client-5.6.21-1.rhel5.x86_64.rpm Preparing...###########################################[100%] 1:MysqL-client###########################################[100%] [root@localhost~]#rpm-ivhMysqL-devel-5.6.21-1.rhel5.x86_64.rpm Preparing...###########################################[100%] 1:MysqL-devel###########################################[100%] [root@localhost~]#rpm-ivhMysqL-server-5.6.21-1.rhel5.x86_64.rpm error:Faileddependencies: libaio.so.1()(64bit)isneededbyMysqL-server-5.6.21-1.rhel5.x86_64 libaio.so.1(LIBAIO_0.1)(64bit)isneededbyMysqL-server-5.6.21-1.rhel5.x86_64 libaio.so.1(LIBAIO_0.4)(64bit)isneededbyMysqL-server-5.6.21-1.rhel5.x86_64 报错:按着提示,继续安装libaio库 [root@localhost~]#yuminstalllibaio
三:启动MysqL,报错
[root@localhostopt]#serviceMysqLrestart ERROR!MysqLserverPIDfilecouldnotbefound! StartingMysqL.ERROR!TheserverquitwithoutupdatingPIDfile(/var/lib/MysqL/localhost.pid).
本次解决方法:
cd /var/lib/MysqL
rm -rf ibdata1 ib_logfile1 ib_logfile0
此时:
serviceMysqLrestart ShuttingdownMysqL..SUCCESS! StartingMysqL.SUCCESS!