<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">由于yum安装的mysql5.1版本略低,所以采用rpm安装mysql5.6</span>
0、卸载,卸载所有与旧版本有关的
rpm -qa | grep mysql
yum remove -y mysql-libs-5.1.66-2.el6_3.x86_64
1、下载rpm文件,采用sohu的源进行下载:http://mirrors.sohu.com/mysql/MySQL-5.6/
下载三个安装包:
MySQL-server-5.6.32-1.el6.x86_64.rpm
MySQL-client-5.6.32-1.el6.x86_64.rpm
MySQL-devel-5.6.32-1.el6.x86_64.rpm
2、开始安装:
[root@cs6b662 /]# rpm -ivh MySQL-server-5.6.32-1.el6.x86_64.rpm
warning: MySQL-server-5.6.32-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ########################################### [100%]
1:MySQL-server ########################################### [100%]
[root@cs6b662 /]# rpm -ivh MySQL-client-5.6.32-1.el6.x86_64.rpm
warning: MySQL-client-5.6.32-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ########################################### [100%]
1:MySQL-client ########################################### [100%]
[root@cs6b662 /]# rpm -ivh MySQL-server-5.6.32-1.el6.x86_64.rpm --nosignature
Preparing... ########################################### [100%]
package MySQL-server-5.6.32-1.el6.x86_64 is already installed
[root@cs6b662 /]# rpm -ivh MySQL-devel-5.6.32-1.el6.x86_64.rpm
warning: MySQL-devel-5.6.32-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ########################################### [100%]
1:MySQL-devel ########################################### [100%]
警告可忽略,或者在命令后加上 --nosignature
3、安装成功后,测试:
[root@cs6b662 /]# service mysql start
Starting MySQL.The server quit without updating PID file (/var/lib/mysql/cs6b662.kryptcloud.com.pid).
结果报错,进入该目录下:
[root@cs6b662 /]# cd /var/lib/mysql
[root@cs6b662 mysql]# ls
cs6b662.kryptcloud.com.err ib_logfile0 mysql RPM_UPGRADE_MARKER-LAST
ibdata1 ib_logfile1 RPM_UPGRADE_HISTORY
发现存在一个cs6b662.kryptcloud.com.err文件,打开发现其中报错:
2016-09-24 05:30:09 21596 [ERROR] InnoDB: auto-extending data file ./ibdata1 is of a different size 640 pages (rounded down to MB) than specified in the .cnf file: initial 768 pages, max 0 (relevant if non-zero) pages!
2016-09-24 05:30:09 21596 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
百度之,删除一下文件即可(在/var/lib/mysql目录下):
[root@cs6b662 mysql]# rm -f ib*
4、药到病除,mysql服务成功启动
[root@cs6b662 mysql]# mysql -V
mysql Ver 14.14 Distrib 5.6.32, for Linux (x86_64) using EditLine wrapper
[root@cs6b662 mysql]# service mysql status
MySQL running (22455) [ OK ]