【Centos 踩坑】Centos6.8自带MySQL5.1.7升级到MySQL5.6【手把手操作】

作为一个小白, 对Centos一点都不熟悉,网上很多mysql升级教程。但是我安装MySQL以后,总是各种各样的问题导致不能用,导致安装以后又卸载,卸载以后又安装,前前后安装卸载了7-8遍,系统搞的烂七八糟的,只有恢复系统,恢复系统以后,系统自带MySQL回到5.1.7,终于找到这篇文章,傻瓜式操作,一步一步来,

这文章我是转载的,地址见下面,如能帮到你,请回来点赞

 

转载地址:http://www.voidcn.com/article/p-xcyojist-bpp.html


正文

  一:查看下是否有系统自带MySQL的rpm包,如果有,需要删除自带的旧rpm包。

[root@localhost mnt]# mysql -V
mysql  Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64) using readline 5.1
[root@localhost mnt]# rpm -qa | grep -i mysql
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@localhost mnt]# yum remove mysql*

二:在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]#wget http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-server-5.6.21-1.rhel5.x86_64.rpm  
[root@linuxidc /mnt]#wget http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-devel-5.6.21-1.rhel5.x86_64.rpm  
[root@linuxidc /mnt]#wget http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-client-5.6.21-1.rhel5.x86_64.rpm

报错:

wget http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-server-5.6.21-1.rhel5.x86_64.rpm
--2017-09-14 17: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 请求,正在等待回应... 301 Moved Permanently
位置:https://dev.mysql.com/Downloads/MySQL-5.6/MySQL-server-5.6.21-1.rhel5.x86_64.rpm [跟随至新的 URL]
--2017-09-14 17: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-certificate http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-server-5.6.21-1.rhel5.x86_64.rpm  
[root@linuxidc /mnt]#wget --no-check-certificate http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-devel-5.6.21-1.rhel5.x86_64.rpm  
[root@linuxidc /mnt]#wget --no-check-certificate http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-client-5.6.21-1.rhel5.x86_64.rpm

然后安装:

[root@localhost ~]# rpm -ivh MySQL-client-5.6.21-1.rhel5.x86_64.rpm 
Preparing...                ########################################### [100%]
   1:MySQL-client           ########################################### [100%]
[root@localhost ~]# rpm -ivh MySQL-devel-5.6.21-1.rhel5.x86_64.rpm 
Preparing...                ########################################### [100%]
   1:MySQL-devel            ########################################### [100%]
[root@localhost ~]# rpm -ivh MySQL-server-5.6.21-1.rhel5.x86_64.rpm 
error: Failed dependencies:
	libaio.so.1()(64bit) is needed by MySQL-server-5.6.21-1.rhel5.x86_64
	libaio.so.1(LIBAIO_0.1)(64bit) is needed by MySQL-server-5.6.21-1.rhel5.x86_64
	libaio.so.1(LIBAIO_0.4)(64bit) is needed by MySQL-server-5.6.21-1.rhel5.x86_64

报错:按着提示,继续安装libaio库
	
[root@localhost ~]# yum install libaio

 

 

三:启动mysql,报错

[root@localhost opt]# service mysql restart
 ERROR! MySQL server PID file could not be found!
Starting MySQL. ERROR! The server quit without updating PID file (/var/lib/mysql/localhost.pid).

本次解决方法:

cd /var/lib/mysql

rm -rf ibdata1 ib_logfile1 ib_logfile0

此时:

service mysql restart
Shutting down MySQL.. SUCCESS! 
Starting MySQL. SUCCESS!

你可能感兴趣的:(Centos,MySQL)