3分钟,YUM升级MYSQL,5.1到5

发布时间:2019-09-15 09:59:30编辑:auto阅读(1754)

    本文介绍如何通过YUM升级Mysql的版本(默认用YUM安装的MySQL都是5.1的版本)


    环境:CENTOS6.9

    原Mysql 版本:5.1

    新Mysql 版本:5.6

    时间需要:3分钟以内


    注意: 做任何动作前,先做好数据备份和恢复计划


    [willson@heegw3o0cZ ~]$ sudo su - root

    [root@heegw3o0cZ ~]#

    [root@heegw3o0cZ ~]#

    [root@heegw3o0cZ ~]# /etc/init.d/mysqld stop

    Stopping mysqld:                                           [  OK  ]

    [root@heegw3o0cZ~]# yum remove mysql

    Loaded plugins: fastestmirror

    Setting up Remove Process

    Resolving Dependencies

    --> Running transaction check

    ---> Package mysql.x86_64 0:5.1.73-8.el6_8 will be erased

    --> Processing Dependency: mysql = 5.1.73-8.el6_8 for package: mysql-devel-5.1.73-8.el6_8.x86_64

    --> Processing Dependency: mysql = 5.1.73-8.el6_8 for package: mysql-server-5.1.73-8.el6_8.x86_64

    --> Running transaction check

    ---> Package mysql-devel.x86_64 0:5.1.73-8.el6_8 will be erased

    ---> Package mysql-server.x86_64 0:5.1.73-8.el6_8 will be erased

    --> Processing Dependency: mysql-server for package: perl-Test-mysqld-0.17-3.el6.noarch

    --> Running transaction check

    ---> Package perl-Test-mysqld.noarch 0:0.17-3.el6 will be erased

    --> Finished Dependency Resolution

    Dependencies Resolved

    ===================================================================================

    Package                 Arch          Version               Repository       Size

    ===================================================================================

    Removing:

    mysql                   x86_64        5.1.73-8.el6_8        @updates        2.4 M

    Removing for dependencies:

    mysql-devel             x86_64        5.1.73-8.el6_8        @updates        388 k

    mysql-server            x86_64        5.1.73-8.el6_8        @updates         25 M

    perl-Test-mysqld        noarch        0.17-3.el6            @epel            14 k

    Transaction Summary

    ===================================================================================

    Remove        4 Package(s)

    Installed size: 27 M

    Is this ok [y/N]: y

    Downloading Packages:

    Running rpm_check_debug

    Running Transaction Test

    Transaction Test Succeeded

    Running Transaction

      Erasing    : mysql-devel-5.1.73-8.el6_8.x86_64                               1/4

      Erasing    : perl-Test-mysqld-0.17-3.el6.noarch                              2/4

      Erasing    : mysql-server-5.1.73-8.el6_8.x86_64                              3/4

    warning: /var/log/mysqld.log saved as /var/log/mysqld.log.rpmsave

      Erasing    : mysql-5.1.73-8.el6_8.x86_64                                     4/4

      Verifying  : perl-Test-mysqld-0.17-3.el6.noarch                              1/4

      Verifying  : mysql-server-5.1.73-8.el6_8.x86_64                              2/4

      Verifying  : mysql-5.1.73-8.el6_8.x86_64                                     3/4

      Verifying  : mysql-devel-5.1.73-8.el6_8.x86_64                               4/4

    Removed:

      mysql.x86_64 0:5.1.73-8.el6_8

    Dependency Removed:

      mysql-devel.x86_64 0:5.1.73-8.el6_8      mysql-server.x86_64 0:5.1.73-8.el6_8

      perl-Test-mysqld.noarch 0:0.17-3.el6

    Complete!

    [root@heegw3o0cZ ~]#

    [root@heegw3o0cZ ~]# rpm -Uvh http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm

    Retrieving http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm

    Preparing...                ########################################### [100%]

       1:mysql-community-release########################################### [100%]

    [root@heegw3o0cZ ~]# yum install mysql-community-server

    Loaded plugins: fastestmirror

    Setting up Install Process

    Determining fastest mirrors

    * base: mirrors.aliyuncs.com

    * epel: mirrors.aliyuncs.com

    * extras: mirrors.aliyuncs.com

    * updates: mirrors.aliyuncs.com

    base                                                        | 3.7 kB     00:00

    epel                                                        | 4.7 kB     00:00

    epel/primary_db                                             | 6.0 MB     00:00

    extras                                                      | 3.4 kB     00:00

    extras/primary_db                                           |  29 kB     00:00

    mysql-connectors-community                                  | 2.5 kB     00:00

    mysql-connectors-community/primary_db                       |  17 kB     00:00

    mysql-tools-community                                       | 2.5 kB     00:00

    mysql-tools-community/primary_db                            |  38 kB     00:00

    mysql56-community                                           | 2.5 kB     00:00

    mysql56-community/primary_db                                | 197 kB     00:00

    updates                                                     | 3.4 kB     00:00

    updates/primary_db                                          | 5.3 MB     00:00

    zabbix                                                      |  951 B     00:00

    zabbix-non-supported                                        |  951 B     00:00

    Resolving Dependencies

    --> Running transaction check

    ---> Package mysql-community-server.x86_64 0:5.6.38-2.el6 will be installed

    --> Processing Dependency: mysql-community-common(x86-64) = 5.6.38-2.el6 for package: mysql-community-server-5.6.38-2.el6.x86_64

    --> Processing Dependency: mysql-community-client(x86-64) >= 5.6.10 for package: mysql-community-server-5.6.38-2.el6.x86_64

    --> Running transaction check

    ---> Package mysql-community-client.x86_64 0:5.6.38-2.el6 will be installed

    --> Processing Dependency: mysql-community-libs(x86-64) >= 5.6.10 for package: mysql-community-client-5.6.38-2.el6.x86_64

    ---> Package mysql-community-common.x86_64 0:5.6.38-2.el6 will be installed

    --> Running transaction check

    ---> Package mysql-community-libs.x86_64 0:5.6.38-2.el6 will be obsoleting

    ---> Package mysql-libs.x86_64 0:5.1.73-8.el6_8 will be obsoleted

    --> Processing Dependency: libmysqlclient.so.16()(64bit) for package: 2:postfix-2.6.6-8.el6.x86_64

    --> Processing Dependency: libmysqlclient.so.16()(64bit) for package: redland-1.0.7-11.el6.x86_64

    --> Processing Dependency: libmysqlclient.so.16()(64bit) for package: perl-DBD-MySQL-4.013-3.el6.x86_64

    --> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: 2:postfix-2.6.6-8.el6.x86_64

    --> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: redland-1.0.7-11.el6.x86_64

    --> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: perl-DBD-MySQL-4.013-3.el6.x86_64

    --> Running transaction check

    ---> Package mysql-community-libs-compat.x86_64 0:5.6.38-2.el6 will be obsoleting

    --> Finished Dependency Resolution

    Dependencies Resolved

    ===================================================================================

    Package                       Arch     Version          Repository           Size

    ===================================================================================

    Installing:

    mysql-community-libs          x86_64   5.6.38-2.el6     mysql56-community   1.9 M

         replacing  mysql-libs.x86_64 5.1.73-8.el6_8

    mysql-community-libs-compat   x86_64   5.6.38-2.el6     mysql56-community   1.6 M

         replacing  mysql-libs.x86_64 5.1.73-8.el6_8

    mysql-community-server        x86_64   5.6.38-2.el6     mysql56-community    55 M

    Installing for dependencies:

    mysql-community-client        x86_64   5.6.38-2.el6     mysql56-community    18 M

    mysql-community-common        x86_64   5.6.38-2.el6     mysql56-community   308 k

    Transaction Summary

    ===================================================================================

    Install       5 Package(s)

    Total download size: 77 M

    Is this ok [y/N]: y

    Downloading Packages:

    (1/5): mysql-community-client-5.6.38-2.el6.x86_64.rpm       |  18 MB     00:01

    (2/5): mysql-community-common-5.6.38-2.el6.x86_64.rpm       | 308 kB     00:00

    (3/5): mysql-community-libs-5.6.38-2.el6.x86_64.rpm         | 1.9 MB     00:00

    (4/5): mysql-community-libs-compat-5.6.38-2.el6.x86_64.rpm  | 1.6 MB     00:00

    (5/5): mysql-community-server-5.6.38-2.el6.x86_64.rpm       |  55 MB     00:04

    -----------------------------------------------------------------------------------

    Total                                               11 MB/s |  77 MB     00:06

    warning: rpmts_HdrFromFdno: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

    Retrieving key from file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

    Importing GPG key 0x5072E1F5:

    Userid : MySQL Release Engineering <mysql-build@oss.oracle.com>

    Package: mysql-community-release-el6-5.noarch (installed)

    From   : file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

    Is this ok [y/N]: y

    Running rpm_check_debug

    Running Transaction Test

    Transaction Test Succeeded

    Running Transaction

    Warning: RPMDB altered outside of yum.

    ** Found 3 pre-existing rpmdb problem(s), 'yum check' output follows:

    tomcat6-6.0.24-98.el6_8.noarch has missing requires of tomcat6-lib = ('0', '6.0.24', '98.el6_8')

    tomcat6-admin-webapps-6.0.24-105.el6_8.noarch has missing requires of tomcat6 = ('0', '6.0.24', '105.el6_8')

    tomcat6-webapps-6.0.24-105.el6_8.noarch has missing requires of tomcat6 = ('0', '6.0.24', '105.el6_8')

      Installing : mysql-community-common-5.6.38-2.el6.x86_64                      1/6

      Installing : mysql-community-libs-5.6.38-2.el6.x86_64                        2/6

      Installing : mysql-community-client-5.6.38-2.el6.x86_64                      3/6

      Installing : mysql-community-server-5.6.38-2.el6.x86_64                      4/6

    warning: /etc/my.cnf created as /etc/my.cnf.rpmnew

      Installing : mysql-community-libs-compat-5.6.38-2.el6.x86_64                 5/6

      Erasing    : mysql-libs-5.1.73-8.el6_8.x86_64                                6/6

      Verifying  : mysql-community-common-5.6.38-2.el6.x86_64                      1/6

      Verifying  : mysql-community-libs-5.6.38-2.el6.x86_64                        2/6

      Verifying  : mysql-community-libs-compat-5.6.38-2.el6.x86_64                 3/6

      Verifying  : mysql-community-client-5.6.38-2.el6.x86_64                      4/6

      Verifying  : mysql-community-server-5.6.38-2.el6.x86_64                      5/6

      Verifying  : mysql-libs-5.1.73-8.el6_8.x86_64                                6/6

    Installed:

      mysql-community-libs.x86_64 0:5.6.38-2.el6

      mysql-community-libs-compat.x86_64 0:5.6.38-2.el6

      mysql-community-server.x86_64 0:5.6.38-2.el6

    Dependency Installed:

      mysql-community-client.x86_64 0:5.6.38-2.el6

      mysql-community-common.x86_64 0:5.6.38-2.el6

    Replaced:

      mysql-libs.x86_64 0:5.1.73-8.el6_8

    Complete!

    [root@heegw3o0cZ ~]# mysql -V

    mysql  Ver 14.14 Distrib 5.6.38, for Linux (x86_64) using  EditLine wrapper

    [root@heegw3o0cZ ~]# /etc/init.d/mysqld start

    Starting mysqld:                                           [  OK  ]

    [root@heegw3o0cZ ~]# mysql

    Welcome to the MySQL monitor.  Commands end with ; or \g.

    Your MySQL connection id is 2

    Server version: 5.6.38 MySQL Community Server (GPL)

    Copyright (c) 2000, 2017, 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 |

    | mysql              |

    | rt3                |

    +--------------------+

    7 rows in set (0.00 sec)

    mysql>


关键字