`

How to upgrade MySQL 5.5 to MySQL 5.6 on CentOS 6.3/Red-hat/Fedora

 
阅读更多
How to upgrade MySQL 5.5 to MySQL 5.6 on CentOS 6.3/Red-hat/Fedora
1 Reply

As I mentioned in my other post for installing MySQL 5.6 on a new server, first head over here and download MySQL 5.6.10 rpm’s under Oracle & Redhat Linux 6 section of rpm’s.You want to download these rpm’s to your CentOS 6 server [As we will install 64-bit version on MySQL 5.6] :

    Red Hat/Oracle Enterprise Linux ver. 6 (x86, 64-bit), RPM Package – MySQL Server : MySQL-server-5.6.10-1.el6.x86_64.rpm
    Red Hat/Oracle Enterprise Linux ver. 6 (x86, 64-bit), RPM Package – Shared components : MySQL-shared-5.6.10-1.el6.x86_64.rpm
    Red Hat/Oracle Enterprise Linux ver. 6 (x86, 64-bit), RPM Package – Client Utilities : MySQL-client-5.6.10-1.el6.x86_64.rpm

To download on command line [Make sure that you have wget utility installed, if you dont then install it]:

yum install wget



Now download the rpm’s:

wget http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-shared-5.6.10-1.el6.x86_64.rpm/from/http://cdn.mysql.com/

wget http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-client-5.6.10-1.el6.x86_64.rpm/from/http://cdn.mysql.com/

wget http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-server-5.6.10-1.el6.x86_64.rpm/from/http://cdn.mysql.com/

mysql 5.6 download

We now have our rpm’s to upgrade our server to MySQL 5.6

Before we proceed further, stop existing MySQL Server. Run the following command to stop your server [Assuming your init.d start-up script in named as MySQL, you can check that in /etc/init.d directory]:

service mysql stop

mysql 5.5 stop

Now move the data directory under /var/lib/mysql to /var/lib/mysql_55. Run the following command in order to move. [If you used custom path when you installed MySQL 5.5 then change below command appropriately]

mv /var/lib/mysql/ /var/lib/mysql_55

move mysql 5.5 directory

Now you can securely remove the existing installation of MySQL 5.5 rpm’s from your server, before we install the new MySQL 5.6 database engine. Check what existing packages are installed on our existing database server that correspond to MySQL 5.5 engine. To do that run the following command :

rpm -qa | grep -i mysql

find rpm installed packages

Running the above command returns the following packages as that are currently installed in existing database server. Now remove them one by one from server in order for us to install MySQL 5.6 engine.

To remove we can simply run the following:

yum remove MySQL-server-5.5.30-1.el6.x86_64 MySQL-shared-5.5.30-1.el6.x86_64 MySQL-client-5.5.30-1.el6.x86_64

Image 026

Now you have remove all MySQL 5.5 related libraries that correspond to MySQL 5.5 database engine.

Now lets install MySQL 5.6.10 from the rpm’s that we downloaded earlier. To install them just run the following commands:

rpm -ivh MySQL-shared-5.6.10-1.el6.x86_64.rpm

rpm -ivh MySQL-client-5.6.10-1.el6.x86_64.rpm

rpm -ivh MySQL-server-5.6.10-1.el6.x86_64.rpm

Image 027 Image 028

MySQL 5.6 Server Installation log :

Preparing… ########################################### [100%]
1:MySQL-server ########################################### [100%]
2013-02-10 11:51:26 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use –explicit_defaults_for_timestamp server option (see documentation for more details).
2013-02-10 11:51:26 1908 [Note] InnoDB: The InnoDB memory heap is disabled
2013-02-10 11:51:26 1908 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2013-02-10 11:51:26 1908 [Note] InnoDB: Compressed tables use zlib 1.2.3
2013-02-10 11:51:26 1908 [Note] InnoDB: CPU does not support crc32 instructions
2013-02-10 11:51:26 1908 [Note] InnoDB: Using Linux native AIO
2013-02-10 11:51:26 1908 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2013-02-10 11:51:26 1908 [Note] InnoDB: Completed initialization of buffer pool
2013-02-10 11:51:26 1908 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2013-02-10 11:51:26 1908 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2013-02-10 11:51:26 1908 [Note] InnoDB: Database physically writes the file full: wait…
2013-02-10 11:51:26 1908 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2013-02-10 11:51:27 1908 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2013-02-10 11:51:27 1908 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2013-02-10 11:51:27 1908 [Warning] InnoDB: New log files created, LSN=45781
2013-02-10 11:51:27 1908 [Note] InnoDB: Doublewrite buffer not found: creating new
2013-02-10 11:51:27 1908 [Note] InnoDB: Doublewrite buffer created
2013-02-10 11:51:27 1908 [Note] InnoDB: 128 rollback segment(s) are active.
2013-02-10 11:51:27 1908 [Warning] InnoDB: Creating foreign key constraint system tables.
2013-02-10 11:51:27 1908 [Note] InnoDB: Foreign key constraint system tables created
2013-02-10 11:51:27 1908 [Note] InnoDB: Creating tablespace and datafile system tables.
2013-02-10 11:51:27 1908 [Note] InnoDB: Tablespace and datafile system tables created.
2013-02-10 11:51:27 1908 [Note] InnoDB: Waiting for purge to start
2013-02-10 11:51:27 1908 [Note] InnoDB: 1.2.10 started; log sequence number 0
A random root password has been set. You will find it in ‘/root/.mysql_secret’.
2013-02-10 11:51:28 1908 [Note] Binlog end
2013-02-10 11:51:28 1908 [Note] InnoDB: FTS optimize thread exiting.
2013-02-10 11:51:28 1908 [Note] InnoDB: Starting shutdown…
2013-02-10 11:51:29 1908 [Note] InnoDB: Shutdown completed; log sequence number 1625977

2013-02-10 11:51:29 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use –explicit_defaults_for_timestamp server option (see documentation for more details).
2013-02-10 11:51:29 1931 [Note] InnoDB: The InnoDB memory heap is disabled
2013-02-10 11:51:29 1931 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2013-02-10 11:51:29 1931 [Note] InnoDB: Compressed tables use zlib 1.2.3
2013-02-10 11:51:29 1931 [Note] InnoDB: CPU does not support crc32 instructions
2013-02-10 11:51:29 1931 [Note] InnoDB: Using Linux native AIO
2013-02-10 11:51:29 1931 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2013-02-10 11:51:29 1931 [Note] InnoDB: Completed initialization of buffer pool
2013-02-10 11:51:29 1931 [Note] InnoDB: Highest supported file format is Barracuda.
2013-02-10 11:51:29 1931 [Note] InnoDB: 128 rollback segment(s) are active.
2013-02-10 11:51:29 1931 [Note] InnoDB: Waiting for purge to start
2013-02-10 11:51:29 1931 [Note] InnoDB: 1.2.10 started; log sequence number 1625977
2013-02-10 11:51:29 1931 [Note] Binlog end
2013-02-10 11:51:29 1931 [Note] InnoDB: FTS optimize thread exiting.
2013-02-10 11:51:29 1931 [Note] InnoDB: Starting shutdown…
2013-02-10 11:51:31 1931 [Note] InnoDB: Shutdown completed; log sequence number 1625987

A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !

You will find that password in ‘/root/.mysql_secret’.

You must change that password on your first connect,
no other statement but ‘SET PASSWORD’ will be accepted.
See the manual for the semantics of the ‘password expired’ flag.

Also, the account for the anonymous user has been removed.

In addition, you can run:

/usr/bin/mysql_secure_installation

which will also give you the option of removing the test database.
This is strongly recommended for production servers.

See the manual for more instructions.

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available on the web at

http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

WARNING: Found existing config file /usr/my.cnf on the system.
Because this file might be in use, it was not replaced,
but was used in bootstrap (unless you used –defaults-file)
and when you later start the server.
The new default config file was created as /usr/my-new.cnf,
please compare it with your file and take the changes you need.

We are now done with installing MySQL 5.6 server. Now before we start the server we need to move back the data directory that we moved earlier and put back to where it was. I will be copying back rather than moving as a fail safe if the upgrade fails. Then we still have the original data directory in place to fix things up or install MySQL 5.5 server backs to its place for rolling back the upgrade process.

mv /var/lib/mysql /var/lib/mysql_56_clean

cp -R /var/lib/mysql_55 /var/lib/mysql

Image 029

Now we have our data directory back to its place. Right now we are in a state that our engine libraries correspond to MySQL 5.6.10 and our data directory is of MySQL 5.5. We need to upgrade our data directory to be compatible with MySQL 5.6 database engine. In order to proceed further we need to start the database engine now.

service mysql start

error starting mysql

Bam ! there will be an error starting the database engine as shown above:

Starting MySQL. ERROR! The server quit without updating PID file (/var/lib/mysql/open sourcedbms.pid).

Database engine will fail to start as permissions on data directory are wrong. To fix that run the following command :

chown -R mysql:mysql /var/lib/mysql

Image 033

Now try starting the database server again with same command:

service mysql start

and you should be able to successfully start it. [If you did not, you might have data directories installed in a different path or custom config file paths etc., check you database logs and see if those tell something about it. Please put that in this blog comments and I will try to solve that if possible based on my understanding]

Image 034

Now lets upgrade the data directories to be compatible with MySQL 5.6 engine to play nice with this new engine. To upgrade we need to run mysql_upgrade. This utility checks your tables, and attempts to repair them if necessary. It also updates your grant tables to make sure that they have the current structure so that you can take advantage of any new capabilities. Please use an existing super user that you have in your database [5.5] engine to run this utility. Please change the host/user/password according to your parameters/settings.

mysql_upgrade -hopensourcedbms -uroot -p

Image 037

mysql_upgrade utility should start fixing your existing tables.

Image 018

Now you have successfully updated your data directory as well. This completes full upgrade of MySQL 5.5 database server to MySQL 5.6 database server.

Try connecting from any existing client and you should be able to connect successfully to this database server.

sqlyog mysql 5.6

There are certainly a lot of config parameter changes / feature changes in MySQL 5.6 database version. I highly recommend going through those new welcome additions in MySQL 5.6 version and tune your database server accordingly [Also go through Server Administration / Security areas from 5.6 Manual for good understanding ]. Also this upgrade is a lot straight forward as I did not have to deal with existing server config parameters, custom paths etc., I would say think through this tutorial and act according to your environment/needs.

Before you proceed to do this on your production servers make sure that you block 3306 [Or what ever port your database server runs on] port from your iptables and test this process in pre-production environments at-least couple of times.

Last but not least make sure that this new MySQL server is enabled to auto start when server restarts.
分享到:
评论

相关推荐

    CentOS 6.3安装(超级详细图解教程)

    - **CentOS 6.3** 是一个基于 Red Hat Enterprise Linux (RHEL) 的开源操作系统版本。它提供了一个稳定、可靠且免费的企业级计算平台,特别适用于服务器环境。 #### 二、CentOS 6.3 镜像下载与准备 - **下载地址**...

    CentOS 6.3 安装详细教程

    ### CentOS 6.3 安装教程知识点解析 #### 一、CentOS 6.3 系统概述 - **CentOS**:一种基于Linux内核的开源操作系统,旨在提供一个稳定、高预测性且免费的企业级计算平台。CentOS 6.3作为其6.x系列的一个版本,在...

    安装CentOS6.3系统

    ### 安装CentOS 6.3系统的详细指南 #### 一、准备工作 在开始安装CentOS 6.3之前,我们需要确保已经准备好了必要的工具和资源。首先,需要从官方镜像站点下载CentOS 6.3的ISO镜像文件。根据提供的链接: - **下载...

    远程安装CentOS6.3

    远程安装 CentOS 6.3 并进行硬 RAID 配置 本文将指导用户如何远程安装 CentOS 6.3 操作系统,并在不同服务商的服务器上进行硬 RAID 配置。同时,本文还将详细介绍 CentOS 6.3 的安装过程和需求。 远程安装 CentOS ...

    mysql5.5升级完整包

    mysql5.5升级的所有包。 1、安装MySQL 5.5.x的yum源: rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm 2、安装MySQL客户端的支持包: yum install libmysqlclient15 --enablerepo=webtatic 3、卸载...

    CentOS_6.3安装超级详细图解教程

    ### CentOS 6.3 安装超级详细图解教程知识点概览 ...- **下载地址**:提供了32位和64位两个版本的下载链接,分别是`http://mirror.centos.org/centos/6.3/isos/i386/CentOS-6.3-i386-bin-DVD1to2.torrent`和`...

    CentOS 6.5系统安装配置图解教程

    ### CentOS 6.5系统安装配置详解 #### 一、CentOS 6.5系统概述与准备工作 **CentOS 6.5**是一款基于Linux内核的操作系统,它以其稳定性、安全性以及广泛的社区支持而受到许多企业和开发者的青睐。本文旨在提供一个...

    mysql5.1升级mysql5.5操作步骤

    ### MySQL 5.1 升级至 MySQL 5.5 的关键知识点 #### MySQL 5.5 新特性 - **默认存储引擎改变**:MySQL 5.5 中默认的存储引擎由 MyISAM 改为了 InnoDB。这一改变极大地提高了数据库的安全性和可靠性,因为 InnoDB ...

    AccessControl-6.3-cp312-cp312-win_amd64.whl.zip

    标题中的"AccessControl-6.3-cp312-cp312-win_amd64.whl.zip"是一个Python库的发行版本,名为"AccessControl",版本号为6.3。这里的"cp312"指的是它适用于Python 3.12版本,而"win_amd64"则表明它是为Windows操作...

    教你如何在Linux上编译MySql5.6源码 菜鸟必备

    在Linux系统上编译MySQL 5.6源码是一项对新手来说可能较为复杂的任务,但通过逐步学习和实践,你可以掌握这一技能。本文将详细解释这个过程,帮助你理解每一步的操作及其背后的原理。 首先,确保你的Linux环境满足...

    gcc/pcre-devel/openssl-devel/zlib-devel negix centos7依赖rpm

    在Linux系统中,尤其是CentOS 7这样的企业级操作系统,软件的安装和管理通常依赖于RPM(Red Hat Package Manager)包管理系统。标题中的“gcc/pcre-devel/openssl-devel/zlib-devel negix centos7依赖rpm”揭示了几...

    mysql版本5.5.x升级到5.6.x步骤分享

    大概步骤是:  把配置文件添加:skip-grant-tables参数,把basedir升级成新版本,启动mysql,执行命令:mysql_upgrade...shell > mv /usr/local/mysql /usr/local/mysql.bak #把mysql5.5.x的旧basedir改名为备份目录

    Linux-mysql5.5

    【MySQL 5.5在Linux系统中的安装与配置】 MySQL 5.5是MySQL数据库管理系统的一个重要版本,它提供了许多增强的功能和性能优化。在Linux环境下安装和配置MySQL 5.5是许多系统管理员和开发者的基本技能之一。下面将...

    Centos6.3安装

    在本文中,我们将深入探讨如何安装CentOS 6.3操作系统,这是一个历史悠久但仍然被一些用户使用的Linux发行版。在安装过程中,我们会遇到各种选择,包括安装类型、媒体验证、语言设置、分区策略以及安装类型等。让...

    centos安装mysql5.5.txt

    ### CentOS 安装 MySQL 5.5 的详细步骤与注意事项 #### 一、背景介绍 在 CentOS 系统上安装 MySQL 数据库是一项常见的任务,尤其是对于 Web 开发者和系统管理员来说。本文将详细介绍如何在 CentOS 系统上安装 ...

    mysql 5.5升级到5.7

    ### MySQL 5.5 升级到 5.7 的步骤与注意事项 #### 背景介绍 在本文档中,我们将详细介绍如何将MySQL数据库从版本5.5.46升级到5.7.9的过程。这个过程是在Ubuntu 14.04系统上进行的。升级MySQL的主要目的是为了利用...

    CentOS-7-x86_64-Minimal-1810.iso镜像

    "centos":CentOS是一个基于Red Hat Enterprise Linux (RHEL)的开源操作系统,它提供了与RHEL高度兼容的环境,但不包含任何商业支持。 "linux":Linux是操作系统内核,它与各种用户界面和工具结合,形成了我们所说...

    centos-yumconf-4-4.5.noarch.rpm

    在Linux系统中,RPM(Red Hat Package Manager)是一种广泛使用的软件包管理器,用于安装、升级、查询和卸载软件。 `yum`是Yellowdog Updater, Modified的缩写,是RPM系统上的一个前端软件包管理器,特别为Fedora和...

    centos6.3英文版最小化安装

    1. 引导安装:使用CentOS 6.3的安装ISO启动计算机,你会看到一个菜单,选择“Install or upgrade an existing system”进行安装。 2. 跳过媒体检查:当系统询问是否检查CD媒体时,选择“Skip”以节省时间。 3. ...

Global site tag (gtag.js) - Google Analytics