色粉盒撒娇 发表于 2018-10-6 13:52:12

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

  本文介绍如何通过YUM升级Mysql的版本(默认用YUM安装的MySQL都是5.1的版本)
  环境:CENTOS6.9
  原Mysql 版本:5.1
  新Mysql 版本:5.6
  时间需要:3分钟以内
  注意: 做任何动作前,先做好数据备份和恢复计划
  $ sudo su - root
  #
  #
  # /etc/init.d/mysqld stop
  Stopping mysqld:                                          
  # 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>  Is this ok : 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!
  #
  # 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...                ###########################################
  1:mysql-community-release###########################################
  # 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
  replacingmysql-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
  replacingmysql-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>  Is this ok : 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>  Retrieving key from file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
  Importing GPG key 0x5072E1F5:

  Userid : MySQL>  Package: mysql-community-release-el6-5.noarch (installed)
  From   : file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
  Is this ok : y
  Running rpm_check_debug
  Running Transaction Test
  Transaction Test Succeeded
  Running Transaction

  Warning: RPMDB>  ** 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!
  # mysql -V
  mysqlVer 14.14 Distrib 5.6.38, for Linux (x86_64) usingEditLine wrapper
  # /etc/init.d/mysqld start
  Starting mysqld:                                          
  # mysql
  Welcome to the MySQL monitor.Commands end with ; or \g.

  Your MySQL connection>  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>

页: [1]
查看完整版本: 3分钟,YUM升级MYSQL,5.1到5.6