您的位置:首页 > 数据库 > MySQL

MySQL5.6.25升级MySQL5.7.15

2017-01-10 19:14 274 查看


升级


环境介绍

Part1:写在最前

提到MySQL升级,网上文章数之不尽,但大多数为老的版本,诸如升级到、升级到,今天给大家介绍下升级到版本的方法和注意事项。

Part2:升级方法

升级的方法一般有两类:

1.利用mysqldump来直接导出sql文件,导入到新库中,这种方法是最省事儿的,也是最保险的,缺点的话,也显而易见,大库的mysqldump费时费力。
2.直接替换掉mysql的安装目录和,利用mysql_upgrade 来完成系统表的升级,这种方法需要备份原有的文件,但属于物理拷贝,速度较快。缺点的话,跨版本升级不推荐这么做,比如升级到,升级到等。

本文采用的是第二种方法升级。

Part3:环境

数据库软件目录:/usr/local/mysql

位置:/etc/

数据库data目录:/data/mysql

慢日志目录:/data/slowlog


准备工作

Part1:

# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: -log MySQL Community Server (GPL)
Copyright (c) 2000, 2015, 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()  |
+------------+
| -log |
+------------+
1 row in set ( sec)
mysql> use helei;
Database changed
mysql> show tables;
+-----------------+
| Tables_in_helei |
+-----------------+
| helei           |
+-----------------+
1 row in set ( sec)


我这里用的是版本作为待升级库,库中已经模拟和创建了数据库helei和表helei,用以之后验证升级。

[root@HE3 ~]# /etc//mysqld start
Starting MySQL..... SUCCESS! 
[root@HE3 ~]# ps -ef|grep mysql
root     26467     1  0 20:30 pts/2    00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/
mysql    27197 26467  4 20:30 pts/2    00:00:01 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/ --open-files-limit=8192 --pid-file=/data/mysql/ --socket=/tmp/ --port=3306
root     27235 25656  0 20:31 pts/2    00:00:00 grep mysql

这里虽然启动成功了,但error日志里能捕捉到很多错误信息,因为没有升级字典,诸如:

2016-10-20T03:30: 0 [ERROR] Native table 'performance_schema'.'events_statements_summary_by_program' has the wrong structure
2016-10-20T03:30: 0 [ERROR] Native table 'performance_schema'.'events_transactions_current' has the wrong structure
2016-10-20T03:30: 0 [ERROR] Native table 'performance_schema'.'events_transactions_history' has the wrong structure
2016-10-20T03:30: 0 [ERROR] Native table 'performance_schema'.'events_transactions_history_long' has the wrong structure
2016-10-20T03:30: 0 [ERROR] Native table 'performance_schema'.'events_transactions_summary_by_thread_by_event_name' has the wrong structure
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: