欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

MySQL5.6升级5.7步骤

程序员文章站 2022-07-09 19:00:37
升级步骤: 1、对mysql5.6进行全库备份( )用于失败倒回 2、关闭mysql5.6版本数据库 3、将mysql5.7软件部署 4、修改配置信息 5、修改启动脚本 6、启动mysql5.7数据库 7、mysql_upgrade升级数据库相关参数 8、重启数据库,测试升级结果 首先对数据库进行物 ......

升级步骤:

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