一:查看下是否有系统自带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.rpmMySQL-devel-5.6.21-1.rhel5.x86_64.rpmMySQL-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!