MySQL version upgrade record

Source: Internet
Author: User

MySQL version upgrade record

/*************************************** **************
Upgrade MySQL 5.6.19 to 5.6.21

**************************************** *************/
Backup is required before upgrade!

---- 1. view the data directory location of the current mysql version

Show variables like '% datadir % ';

/Usr/local/mysql01/data/


--- 2. Install the new MySQL version

2. 1. Install the packages required for compiling code

Yum-y install gcc-c ++ autoconf automake zlib * libxml *\
Ncurses-devel libtool-ltdl-devel * make cmake bison-devel libaio

2. Create a group and user for mysql

# Groupadd mysql

# Useradd-g mysql


2. 3. Set system resource limits for users

# Vi/etc/security/limits. conf

Mysql soft nproc 2047
Hard nproc 16384
Mysql soft nofile 1024
Mysql hard nofile 65536

2. 4. Compile and install the new mysql version

Tar xvf mysql-5.6.21.tar.gz

Cd mysql-5.6.21

Compile and install to a new location

Cmake \
-DCMAKE_INSTALL_PREFIX =/usr/local/mysql02 \
-DMYSQL_DATADIR =/usr/local/mysql02/data \
-DSYSCONFDIR =/etc \
-DWITH_MYISAM_STORAGE_ENGINE = 1 \
-DWITH_INNOBASE_STORAGE_ENGINE = 1 \
-DWITH_MEMORY_STORAGE_ENGINE = 1 \
-DWITH_READLINE = 1 \
-DMYSQL_UNIX_ADDR =/usr/local/mysql02/mysql. sock \
-DMYSQL_TCP_PORT = 3306 \
-DENABLED_LOCAL_INFILE = 1 \
-DWITH_PARTITION_STORAGE_ENGINE = 1 \
-DEXTRA_CHARSETS = all \
-DDEFAULT_CHARSET = utf8 \
-DEXTRA_CHARSETS = all \
-DDEFAULT_COLLATION = utf8_general_ci

Make

Make install

2.5 stop old mysql versions

Service mysqld stop

---- 3. Configure MySQL

3. 1. Modify/usr/local/mysql Permissions

# Mkdir-p/usr/local/mysql02

3. 2. Create a data file and a temporary file

Mkdir/usr/local/mysql02/{innodb_data, data, tmp}-p

Mkdir/usr/local/mysql02/mysql_logs/{binary_log, innodb_log, query_log, slow_query_log, error_log}-p

3. Modify permissions

Cd/usr/local/mysql02
Chown-R mysql.
Chgrp-R mysql.

3. 4. Modify parameters

# Vi/etc/my. cnf

Basedir =/usr/local/mysql # specify the database installation directory to the new version.
Datadir =/var/lib/mysql # keep the original database data directory
Skip-grant-tables # skip permission verification because of upgrade requirements
SQL _mode = NO_ENGINE_SUBSTITUTION, in STRICT_TRANS_TABLES
# Remove STRICT_TRANS_TABLES and disable strict data mode
# You only need to modify these values. You do not need to modify other values. If you need to transfer logs to a new directory, you can modify the values as needed.

3. 5. overwrite the Startup File
# Cp/usr/local/mysql02/support-files/mysql. server/etc/init. d/mysqld

. Execute table permission upgrade

# Service mysqld start # restart the new MySQL version

#/Usr/local/mysql02/bin/mysql_upgrade # execute table permission upgrade

3. 7. Check all databases
#/Usr/local/mysql02/bin/mysqlcheck -- all-databases-uroot-p123456

3.8. Restart mysql

# Vi/etc/my. cnf
Remove skip-grant-tables

# Service mysqld restart # Database Upgrade successful

 

-------------------------------------- Split line --------------------------------------

Install MySQL in Ubuntu 14.04

MySQL authoritative guide (original book version 2nd) Clear Chinese scan PDF

Ubuntu 14.04 LTS install LNMP Nginx \ PHP5 (PHP-FPM) \ MySQL

Build a MySQL Master/Slave server in Ubuntu 14.04

Build a highly available distributed MySQL cluster using Ubuntu 12.04 LTS

Install MySQL5.6 and Python-MySQLdb in the source code of Ubuntu 12.04

MySQL-5.5.38 universal binary Installation

-------------------------------------- Split line --------------------------------------

This article permanently updates the link address:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.