1. Background
MySQL 5.7 is the latest version of MySQL and has the following features compared to MySQL 5.6
*Performance and scalability: Improve InnoDB scalability and temporary table performance for faster operations such as network and large data loading.
* JSON support: Using MySQL's JSON capabilities, you can combine NoSQL's flexibility with the power of relational databases.
*Improve replication to improve usability performance.Includes multisource replication, multithread enhancements, online GTIDs, and enhanced semi-synchronous replication.
* Performance mode provides a better perspective.We have added a number of new monitoring capabilities to reduce space and overload and significantly improve usability with the new SYS mode.
*Security: We implement the "Security First" requirement, and many new MySQL 5.7 features help users keep their databases secure.
*Optimization: Most parsers, optimizers, and cost models have been rewritten.This improves maintainability, scalability, and performance.
* GIS: MySQL 5.7 new features, including InnoDB spatial index, use Boost.Geometry while improving integrity and standards compliance.
2. Currently running MySQL 5.6 environment
* Current version of MySQL
[root@MySQL ~]# /usr/local/mysql/bin/mysql -p123456 Warning: Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.6.36 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> select version(); +-----------+ | version() | +-----------+ | 5.6.36 | +-----------+ 1 row in set (0.05 sec) mysql>
* The directory where MySQL is located
[root@MySQL ~]# ll /usr/local/mysql-5.6.36-linux-glibc2.5-x86_64 total 72 drwxr-xr-x 2 mysql mysql 4096 Jun 24 04:05 bin -rw-r--r-- 1 mysql mysql 17987 Mar 18 14:43 COPYING drwxr-xr-x 3 mysql mysql 4096 Jun 24 04:05 data drwxr-xr-x 2 mysql mysql 4096 Jun 24 04:05 docs drwxr-xr-x 3 mysql mysql 4096 Jun 24 04:05 include drwxr-xr-x 3 mysql mysql 4096 Jun 24 04:06 lib drwxr-xr-x 4 mysql mysql 4096 Jun 24 04:05 man -rw-r--r-- 1 root root 943 Jun 24 04:08 my.cnf drwxr-xr-x 10 mysql mysql 4096 Jun 24 04:05 mysql-test -rw-r--r-- 1 mysql mysql 2496 Mar 18 14:43 README drwxr-xr-x 2 mysql mysql 4096 Jun 24 04:05 scripts drwxr-xr-x 28 mysql mysql 4096 Jun 24 04:05 share drwxr-xr-x 4 mysql mysql 4096 Jun 24 04:06 sql-bench drwxr-xr-x 2 mysql mysql 4096 Jun 24 04:05 support-files
* The directory where MySQL data is located
[root@MySQL ~]# ll /data/mysql_data total 110616 -rw-rw---- 1 mysql mysql 56 Jun 24 04:10 auto.cnf -rw-rw---- 1 mysql mysql 12582912 Jun 24 04:10 ibdata1 -rw-rw---- 1 mysql mysql 50331648 Jun 24 04:10 ib_logfile0 -rw-rw---- 1 mysql mysql 50331648 Jun 24 04:08 ib_logfile1 drwx------ 2 mysql mysql 4096 Jun 24 04:08 mysql -rw-rw---- 1 mysql mysql 1771 Jun 24 04:10 MySQL.err -rw-rw---- 1 mysql mysql 6 Jun 24 04:10 MySQL.pid drwx------ 2 mysql mysql 4096 Jun 24 04:08 performance_schema drwx------ 2 mysql mysql 4096 Jun 24 04:08 test
* MySQL startup script basedir and datadir settings
[root@MySQL ~]# grep -E '^basedir=|^datadir=' /etc/init.d/mysqld basedir=/usr/local/mysql datadir=/data/mysql_data
3. Upgrade
*Stop the database normally
[root@MySQL mysql]# /etc/init.d/mysqld stop Shutting down MySQL.. SUCCESS!
*Download the latest version of MySQL 5.7 [recommended to download officially from MySQL]
[root@MySQL ~]# wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz
*Unzip to specified directory
[root@MySQL ~]# tar zxvf mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz -C /usr/local/
*Remove old soft links
[root@MySQL ~]# unlink /usr/local/mysql
*New soft link to MySQL 5.7 directory
[root@MySQL ~]# ln -s /usr/local/mysql-5.7.18-linux-glibc2.5-x86_64 /usr/local/mysql
*Start MySQL through script
[root@MySQL ~]# /etc/init.d/mysqld start Starting MySQL..... SUCCESS!
*Upgrade system tables in MySQL data using mysql_upgrade in MySQL 5.7 package -p specify password
[root@MySQL ~]# /usr/local/mysql/bin/mysql_upgrade -s -p123456 mysql_upgrade: [Warning] Using a password on the command line interface can be insecure. The --upgrade-system-tables option was used, databases won't be touched. Checking if update is needed. Checking server version. Running queries to upgrade MySQL server. Upgrading the sys schema. Upgrade process completed successfully. Checking if update is needed.
*Connect MySQL service to view version
[root@MySQL ~]# /usr/local/mysql/bin/mysql -p123456 mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5 Server version: 5.7.18 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> select version(); +-----------+ | version() | +-----------+ | 5.7.18 | +-----------+ 1 row in set (0.00 sec)
4. Summary
With demand-driven technology, technology itself has no advantages but only business.