一看必会系列:mysql 5.5版本升级到mysql 5.6版本

来源:本站原创 mysql_mariadb 超过416 views围观 0条评论

 

1.停用应用

2.备用所有库

3.增加源

  curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
  wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

 

https://repo.mysql.com/

5.5.35 https://repo.mysql.com/yum/mysql-5.5-community/el/7/x86_64/mysql-community-server-5.5.35-2.el7.x86_64.rpm

5.6.34 https://repo.mysql.com/yum/mysql-5.6-community/el/7/x86_64/mysql-community-server-5.6.35-2.el7.x86_64.rpm

yum -y install gcc gcc-c++ make cmake automake autoconf libxml2 libxml2-devel zlib zlib-devel ncurses ncurses-devel
yum -y install libaio libaio-devel net-tools wget

 

wget https://repo.mysql.com/yum/mysql-5.5-community/el/7/x86_64/mysql-community-common-5.5.35-2.el7.x86_64.rpm
wget https://repo.mysql.com/yum/mysql-5.5-community/el/7/x86_64/mysql-community-libs-5.5.35-2.el7.x86_64.rpm
wget https://repo.mysql.com/yum/mysql-5.5-community/el/7/x86_64/mysql-community-client-5.5.35-2.el7.x86_64.rpm

wget https://repo.mysql.com/yum/mysql-5.6-community/el/7/x86_64/mysql-community-common-5.6.34-2.el7.x86_64.rpm
wget https://repo.mysql.com/yum/mysql-5.6-community/el/7/x86_64/mysql-community-libs-5.6.34-2.el7.x86_64.rpm
wget https://repo.mysql.com/yum/mysql-5.6-community/el/7/x86_64/mysql-community-client-5.6.34-2.el7.x86_64.rpm
按顺序安装
mysql-community-common
mysql-community-libs
mysql-community-client
mysql-community-server

 

4.在线升级

5.备用方案。卸载后再安装,再导入数据

6.回退方案

——–正确的安装过程

[root@localhost ~]# rpm -ivh mysql-community-client-5.5.35-2.el7.x86_64.rpm
Preparing…                          ################################# [100%]
Updating / installing…
   1:mysql-community-client-5.5.35-2.e################################# [100%]
error: unpacking of archive failed on file /usr/bin/mysqlcheck;5a97f082: cpio: read
error: mysql-community-client-5.5.35-2.el7.x86_64: install failed
[root@localhost ~]# rpm -ivh mysql-community-client-5.5.35-2.el7.x86_64.rpm
Preparing…                          ################################# [100%]
Updating / installing…
   1:mysql-community-client-5.5.35-2.e################################# [100%]
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# rpm -ivh mysql-community-server-5.5.35-2.el7.x86_64.rpm
Preparing…                          ################################# [100%]
Updating / installing…
   1:mysql-community-server-5.5.35-2.e################################# [100%]
[root@localhost ~]# systemctl status mysql
Unit mysql.service could not be found.
[root@localhost ~]# systemctl status mysqld
● mysqld.service – MySQL Community Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
[root@localhost ~]# systemctl restart mysqld

———–登陆测试

[root@localhost ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.35 MySQL Community Server (GPL)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql>
mysql>

——————–5.5.45到5.6.34 升级过程

报错
[root@localhost ~]# rpm -ivh mysql-community-common-5.6.34-2.el7.x86_64.rpm
warning: mysql-community-common-5.6.34-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing…                          ################################# [100%]
    file /usr/share/mysql/errmsg-utf8.txt from install of mysql-community-common-5.6.34-2.el7.x86_64 conflicts with file from package mysql-community-common-5.5.35-2.el7.x86_64

解决  先卸载   mysql-community-common-5.5.35-2.el7.x86_64
    [root@localhost ~]# rpm -qa |grep mysql
mysql-community-common-5.5.35-2.el7.x86_64
mysql-community-client-5.5.35-2.el7.x86_64
mysql-community-libs-5.5.35-2.el7.x86_64
mysql-community-server-5.5.35-2.el7.x86_64
[root@localhost ~]# yum remove mysql-community-common-5.5.35-2.el7.x86_64

Removed:
  mysql-community-common.x86_64 0:5.5.35-2.el7                                                                                                           

Dependency Removed:
  mysql-community-client.x86_64 0:5.5.35-2.el7       mysql-community-libs.x86_64 0:5.5.35-2.el7       mysql-community-server.x86_64 0:5.5.35-2.el7     

Complete!

开始安装
[root@localhost ~]# rpm -ivh mysql-community-common-5.6.34-2.el7.x86_64.rpm
warning: mysql-community-common-5.6.34-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing…                          ################################# [100%]
Updating / installing…
   1:mysql-community-common-5.6.34-2.e################################# [100%]
[root@localhost ~]# rpm -ivh mysql-community-client-5.6.34-2.el7.x86_64.rpm
warning: mysql-community-client-5.6.34-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
    mysql-community-libs(x86-64) >= 5.6.10 is needed by mysql-community-client-5.6.34-2.el7.x86_64
[root@localhost ~]# rpm -ivh mysql-community-libs-5.6.34-2.el7.x86_64.rpm
warning: mysql-community-libs-5.6.34-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing…                          ################################# [100%]
Updating / installing…
   1:mysql-community-libs-5.6.34-2.el7################################# [100%]
[root@localhost ~]# rpm -ivh mysql-community-client-5.6.34-2.el7.x86_64.rpm
warning: mysql-community-client-5.6.34-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing…                          ################################# [100%]
Updating / installing…
   1:mysql-community-client-5.6.34-2.e################################# [100%]
[root@localhost ~]# rpm -ivh mysql-community-server-5.6.34-2.el7.x86_64.rpm
warning: mysql-community-server-5.6.34-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing…                          ################################# [100%]
Updating / installing…
   1:mysql-community-server-5.6.34-2.e################################# [100%]
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
启动

systemctl restart  mysqld.service
[root@localhost ~]# !mysql
mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.34 MySQL Community Server (GPL)  —————————验证版本正确,数据都在

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> show databases;
+——————–+
| Database           |
+——————–+
| information_schema |
| bass               |
| budget             |
| mysql              |
| performance_schema |
| test               |
+——————–+
6 rows in set (0.05 sec)

mysql>

 

 

——-安装失败
[root@localhost ~]# rpm -ivh mysql-community-server-5.5.35-2.el7.x86_64.rpm
error: Failed dependencies:
    mysql-community-client(x86-64) = 5.5.35-2.el7 is needed by mysql-community-server-5.5.35-2.el7.x86_64
[root@localhost ~]# rpm -ivh mysql-community-client-5.5.35-2.el7.x86_64.rpm
Preparing…                          ################################# [100%]
Updating / installing…
   1:mysql-community-client-5.5.35-2.e################################# [100%]
error: unpacking of archive failed on file /usr/bin/mysqlcheck;5a97f082: cpio: read
error: mysql-community-client-5.5.35-2.el7.x86_64: install failed    ——-安装包损坏,重新下载
[root@localhost ~]#

———–报错
[root@localhost ~]# rpm -ivh mysql-community-server-5.5.35-2.el7.x86_64.rpm 
error: Failed dependencies:
    mysql-community-client(x86-64) = 5.5.35-2.el7 is needed by mysql-community-server-5.5.35-2.el7.x86_64
    mysql-community-common(x86-64) = 5.5.35-2.el7 is needed by mysql-community-server-5.5.35-2.el7.x86_64
    net-tools is needed by mysql-community-server-5.5.35-2.el7.x86_64
    perl(DBI) is needed by mysql-community-server-5.5.35-2.el7.x86_64
————解决
按顺序安装
mysql-community-common
mysql-community-libs
mysql-community-client
mysql-community-server

    net-tools is needed by mysql-community-server-5.5.35-2.el7.x86_64
    perl(DBI) is needed by mysql-community-server-5.5.35-2.el7.x86_64
    [root@localhost ~]# yum install -y net-tools  perl-DBI
———-解决
    mysql-community-client(x86-64) = 5.5.35-2.el7 is needed by mysql-community-server-5.5.35-2.el7.x86_64
    mysql-community-common(x86-64) = 5.5.35-2.el7 is needed by mysql-community-server-5.5.35-2.el7.x86_64

——–如有冲突

删除原有mariadb
[root@localhost ~]# rpm -qa |grep mariadb
mariadb-libs-5.5.52-1.el7.x86_64
[root@localhost ~]# yum remove -ymariadb-libs-5.5.52-1.el7.x86_64

文章出自:CCIE那点事 http://www.jdccie.com/ 版权所有。本站文章除注明出处外,皆为作者原创文章,可自由引用,但请注明来源。 禁止全文转载。
本文链接:http://www.jdccie.com/?p=3735转载请注明转自CCIE那点事
如果喜欢:点此订阅本站