码迷,mamicode.com
首页 > 数据库 > 详细

MySQL 5.6升级至MySQL 5.7

时间:2017-09-07 23:08:41      阅读:246      评论:0      收藏:0      [点我收藏+]

标签:升级   mysql   

1. 背景

  MySQL 5.7是当前MySQL最新版本,与MySQL 5.6版本相比,有如下特征

* 性能和可扩展性:改进 InnoDB 的可扩展性和临时表的性能,从而实现更快的网络和大数据加载等操作。

   *JSON支持:使用 MySQL JSON 功能,你可以结合 NoSQL 的灵活和关系数据库的强大。

   * 改进复制 以提高可用性的性能。包括多源复制,多从线程增强,在线 GTIDs,和增强的半同步复制。

   * 性能模式 提供更好的视角。我们增加了许多新的监控功能,以减少空间和过载,使用新的 SYS 模式显著提高易用性。

   * 安全: 我们贯彻“安全第一”的要求,许多 MySQL 5.7 新功能帮助用户保证他们数据库的安全。

   * 优化: 重写了大部分解析器,优化器和成本模型。这提高了可维护性,可扩展性和性能。

   *GIS: MySQL 5.7 全新的功能,包括 InnoDB 空间索引,使用 Boost.Geometry,同时提高完整性和标准符合性。 

2. 当前运行的MySQL 5.6环境

   *MySQL当前版本

[root@MySQL ~]#/usr/local/mysql/bin/mysql  -p123456

Warning: Using a password on the commandline 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 CommunityServer (GPL) 

Copyright (c) 2000, 2017, Oracle and/or itsaffiliates. All rights reserved. 

Oracle is a registered trademark of OracleCorporation and/or its

affiliates. Other names may be trademarksof their respective

owners. 

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ toclear the current input statement. 

mysql> select version();

+-----------+

| version() |

+-----------+

| 5.6.36   |

+-----------+

1 row in set (0.05 sec) 

mysql> 

   *MySQL所在目录

[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:05bin

-rw-r--r-- 1 mysql mysql 17987 Mar 18 14:43 COPYING

drwxr-xr-x 3 mysql mysql  4096 Jun 24 04:05data

drwxr-xr-x 2 mysql mysql  4096 Jun 24 04:05docs

drwxr-xr-x 3 mysql mysql  4096 Jun 24 04:05include

drwxr-xr-x 3 mysql mysql  4096 Jun 24 04:06lib

drwxr-xr-x 4 mysql mysql  4096 Jun 24 04:05man

-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:43README

drwxr-xr-x 2 mysql mysql  4096 Jun 24 04:05scripts

drwxr-xr-x 28 mysql mysql  4096 Jun 24 04:05 share

drwxr-xr-x 4 mysql mysql  4096 Jun 24 04:06sql-bench

drwxr-xr-x 2 mysql mysql  4096 Jun 24 04:05support-files 

   *MySQL 数据所在目录

[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 2404:10 ibdata1

-rw-rw---- 1 mysql mysql 50331648 Jun 2404:10 ib_logfile0

-rw-rw---- 1 mysql mysql 50331648 Jun 2404: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 启动脚本basedirdatadir设置

[root@MySQL ~]# grep -E‘^basedir=|^datadir=‘ /etc/init.d/mysqld

basedir=/usr/local/mysql

datadir=/data/mysql_data

3. 升级

   * 正常停止数据库

[root@MySQL mysql]# /etc/init.d/mysqld stop

Shutting down MySQL.. SUCCESS! 

   * 下载 MySQL 5.7 最新版 [ 推荐从MySQL官方下载 ]

[root@MySQL ~]# wgethttps://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz

   * 解压到指定目录

[root@MySQL ~]# tar zxvfmysql-5.7.18-linux-glibc2.5-x86_64.tar.gz -C /usr/local/

   * 删除原有的软链接

[root@MySQL ~]# unlink /usr/local/mysql

   * 新建软链接指向 MySQL5.7目录

[root@MySQL ~]# ln -s  /usr/local/mysql-5.7.18-linux-glibc2.5-x86_64/usr/local/mysql

   * 通过脚本启动MySQL

[root@MySQL ~]# /etc/init.d/mysqld start

Starting MySQL..... SUCCESS!

   * 利用MySQL 5.7包中的mysql_upgrade升级MySQL数据中的系统表 -p指定密码

[root@MySQL ~]#/usr/local/mysql/bin/mysql_upgrade -s -p123456

mysql_upgrade: [Warning] Using a passwordon the command line interface can be insecure.

The --upgrade-system-tables option wasused, 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.

 

   * 连接MySQL服务查看版本

 

[root@MySQL ~]# /usr/local/mysql/bin/mysql-p123456

mysql: [Warning] Using a password on thecommand 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 CommunityServer (GPL) 

Copyright (c) 2000, 2017, Oracle and/or itsaffiliates. All rights reserved. 

Oracle is a registered trademark of OracleCorporation and/or its

affiliates. Other names may be trademarksof their respective

owners. 

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ toclear the current input statement. 

mysql> select version();

+-----------+

| version() |

+-----------+

| 5.7.18   |

+-----------+

1 row in set (0.00 sec)

MySQL 5.6升级至MySQL 5.7

标签:升级   mysql   

原文地址:http://10158955.blog.51cto.com/10148955/1963391

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!