3 minutes, YUM upgrade MYSQL,5.1 to 5.6
This article describes how to upgrade the version of Mysql through YUM (MySQL installed with YUM is version 5.1 by default)
Environment: CENTOS6.9
Original Mysql version: 5.1
New Mysql version: 5.6
Time: within 3 minutes
Note: make a data backup and recovery plan before taking any action.
[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 0RU 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 0RU 5.1.73-8.el6_8 will be erased
-> Package mysql-server.x86_64 0RU 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 0RU 0.17-3.el6 will be erased
-> Finished Dependency Resolution
Dependencies Resolved
=
Package Arch Version Repository Size
=
Removing:
Mysql x8631 64 5.1.73-8.el6_8 @ updates 2.4m
Removing for dependencies:
Mysql-devel x8634 5.1.73-8.el6_8 @ updates 388k
Mysql-server x8631 64 5.1.73-8.el6_8 @ updates 25m
Perl-Test-mysqld noarch 0.17-3.el6 @ epel 14k
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 Compact 4
Erasing: perl-Test-mysqld-0.17-3.el6.noarch 2 Compact 4
Erasing: mysql-server-5.1.73-8.el6_8.x86_64 3 Compact 4
Warning: / var/log/mysqld.log saved as / var/log/mysqld.log.rpmsave
Erasing: mysql-5.1.73-8.el6_8.x86_64 4 Compact 4
Verifying: perl-Test-mysqld-0.17-3.el6.noarch 1 Compact 4
Verifying: mysql-server-5.1.73-8.el6_8.x86_64 2 Compact 4
Verifying: mysql-5.1.73-8.el6_8.x86_64 3 Compact 4
Verifying: mysql-devel-5.1.73-8.el6_8.x86_64 4 Compact 4
Removed:
Mysql.x86_64 0RO 5.1.73-8.el6_8
Dependency Removed:
Mysql-devel.x86_64 0VOR 5.1.73-8.el6_8 mysql-server.x86_64 0RU 5.1.73-8.el6_8
Perl-Test-mysqld.noarch 0RO 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.3MB 00:00
Zabbix | 951B 00:00
Zabbix-non-supported | 951B 00:00
Resolving Dependencies
-> Running transaction check
-> Package mysql-community-server.x86_64 0RU 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 0RU 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 0RU 5.6.38-2.el6 will be installed
-> Running transaction check
-> Package mysql-community-libs.x86_64 0RU 5.6.38-2.el6 will be obsoleting
-> Package mysql-libs.x86_64 0RU 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 0RU 5.6.38-2.el6 will be obsoleting
-> Finished Dependency Resolution
Dependencies Resolved
=
Package Arch Version Repository Size
=
Installing:
Mysql-community-libs x8631 64 5.6.38-2.el6 mysql56-community 1.9m
Replacing mysql-libs.x86_64 5.1.73-8.el6_8
Mysql-community-libs-compat x8631 64 5.6.38-2.el6 mysql56-community 1.6m
Replacing mysql-libs.x86_64 5.1.73-8.el6_8
Mysql-community-server x8631 64 5.6.38-2.el6 mysql56-community 55m
Installing for dependencies:
Mysql-community-client x8631 64 5.6.38-2.el6 mysql56-community 18 M
Mysql-community-common x8631 64 5.6.38-2.el6 mysql56-community 308k
Transaction Summary
=
Install 5 Package (s)
Total download size: 77 M
Is this ok [y/N]: y
Downloading Packages:
(1ap5): mysql-community-client-5.6.38-2.el6.x86_64.rpm | 18 MB 00:01
(2ache 5): mysql-community-common-5.6.38-2.el6.x86_64.rpm | 308 kB 00:00
(3ache 5): mysql-community-libs-5.6.38-2.el6.x86_64.rpm | 1.9 MB 00:00
(4ache 5): mysql-community-libs-compat-5.6.38-2.el6.x86_64.rpm | 1.6 MB 00:00
(5ache 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
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.el6room8')
Tomcat6-webapps-6.0.24-105.el6_8.noarch has missing requires of tomcat6 = ('0,6.0.24,105.el6room8')
Installing: mysql-community-common-5.6.38-2.el6.x86_64 1 Compact 6
Installing: mysql-community-libs-5.6.38-2.el6.x86_64 2 Compact 6
Installing: mysql-community-client-5.6.38-2.el6.x86_64 3 Compact 6
Installing: mysql-community-server-5.6.38-2.el6.x86_64 4 Compact 6
Warning: / etc/my.cnf created as / etc/my.cnf.rpmnew
Installing: mysql-community-libs-compat-5.6.38-2.el6.x86_64 5 Compact 6
Erasing: mysql-libs-5.1.73-8.el6_8.x86_64 6 Compact 6
Verifying: mysql-community-common-5.6.38-2.el6.x86_64 1 Compact 6
Verifying: mysql-community-libs-5.6.38-2.el6.x86_64 2 Compact 6
Verifying: mysql-community-libs-compat-5.6.38-2.el6.x86_64 3 Compact 6
Verifying: mysql-community-client-5.6.38-2.el6.x86_64 4 Compact 6
Verifying: mysql-community-server-5.6.38-2.el6.x86_64 5 Compact 6
Verifying: mysql-libs-5.1.73-8.el6_8.x86_64 6 Compact 6
Installed:
Mysql-community-libs.x86_64 0RO 5.6.38-2.el6
Mysql-community-libs-compat.x86_64 0RO 5.6.38-2.el6
Mysql-community-server.x86_64 0RO 5.6.38-2.el6
Dependency Installed:
Mysql-community-client.x86_64 0RO 5.6.38-2.el6
Mysql-community-common.x86_64 0RO 5.6.38-2.el6
Replaced:
Mysql-libs.x86_64 0RO 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 >