MySQL5.6升级5.7步骤

Posted lzmbdr

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQL5.6升级5.7步骤相关的知识,希望对你有一定的参考价值。

升级步骤:

1、对mysql5.6进行全库备份(******)用于失败倒回
2、关闭mysql5.6版本数据库
3、将mysql5.7软件部署
4、修改配置信息
5、修改启动脚本
6、启动mysql5.7数据库
7、mysql_upgrade升级数据库相关参数
8、重启数据库,测试升级结果

首先对数据库进行物理备份,利用Percona Xtrabackup.
关闭5.6的数据库
安装5.7的二进制安装包.
修改/etc/profile 改变环境变量指向5.7.执行source /etc/profile 生效
编辑5.7的system启动文件

[Unit]
Description=MySQL Server
Documentation=man:mysqld(8)
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
[Service]
User=mysql
Group=mysql
ExecStart=/data/app/mysql/bin/mysqld --defaults-file=/mysql/3306/my.cnf
LimitNOFILE = 5000

启动数据库
systemctl start mysqld
使用mysql_upgrade 检查

[root@db01 ~]# mysql_upgrade -S /mysql/mysql.sock
Checking if update is needed.
Checking server version.
Running queries to upgrade MySQL server.
Checking system database.
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.engine_cost                                  OK
mysql.event                                        OK
mysql.func                                         OK
mysql.general_log                                  OK
mysql.gtid_executed                                OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.innodb_index_stats                           OK
mysql.innodb_table_stats                           OK
mysql.ndb_binlog_index                             OK
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.proxies_priv                                 OK
mysql.server_cost                                  OK
mysql.servers                                      OK
mysql.slave_master_info                            OK
mysql.slave_relay_log_info                         OK
mysql.slave_worker_info                            OK
mysql.slow_log                                     OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.user                                         OK
Upgrading the sys schema.
Checking databases.
sys.sys_config                                     OK
world.city                                         OK
world.country                                      OK
world.countrylanguage                              OK
Upgrade process completed successfully.
Checking if update is needed.

重启数据库

[root@db01 ~]# systemctl restart mysqld
[root@db01 ~]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      8902/sshd           
tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      8912/postmaster     
tcp6       0      0 :::3306                 :::*                    LISTEN      10347/mysqld        
tcp6       0      0 :::22                   :::*                    LISTEN      8902/sshd           
tcp6       0      0 ::1:5432                :::*                    LISTEN      8912/postmaster     

以上是关于MySQL5.6升级5.7步骤的主要内容,如果未能解决你的问题,请参考以下文章

mysql5.6升级到5.7的注意事项

Windows下mysql5.6升级到5.7的方法

MySQL5.6到5.7版本升级采用IN-PLACE的升级方式需要具体关注的地方

升级过程中从 5.6 到 5.7 的 AWS RDS MySQL 复制

将 MySQL 5.6 升级到 5.7

如何升级mysql5.6到5.7 for windows