mysql 从库升主库_mysql_upgrade升级(主从模式,先升级从库)

本文档详细描述了如何在MySQL主从环境中,将从库升级到5.7版本,并将其转换为主库的过程。首先,停止旧版本数据库,备份新版本data目录,然后将旧版本的data复制到新版本,启动新版本数据库。在启动过程中,遇到了因版本不匹配导致的错误,通过`mysql_upgrade`命令修复。最后,启动数据库并验证升级成功,无错误信息,从库顺利升级为主库。
摘要由CSDN通过智能技术生成

我们这里的环境是主从环境,我们将从库先升级到新的版本,然后将从库升级为主库,再升级原来的主库,完成主从环境的升级.

------------------------------------------从库mysql_upgrade升级---------------------------------------------------------------------------------

mysql5.6升级到mysql5.7

具体版本:

5.6.40-->5.7.30

1.下载并安装新版本的mysql

我们这里下载5.7.30并进行安装

2.停掉原来旧版本的数据库

/opt/mysql5640/bin/mysqladmin -h localhost -uroot -pmysql --socket=/opt/mysql5640/data/mysql.sock shutdown

备份新版本的data目录

[root@localhost mysql5730]# cd /opt/mysql5730

[root@localhost mysql5730]# mv data bakdata

将旧版本目录下的data目录拷贝到新版本(新版本已经停掉)的相应目录下

[root@localhost mysql5640]# cd /opt/mysql5640           ##进入到旧数据库的安装目录

[root@localhost mysql5640]# cp -r data /opt/mysql5730/  ##将data文件夹拷贝到新的安装目录

3.修改目录目录权限

[root@localhost mysql5730]# cd /opt/mysql5730

[root@localhost mysql5730]# chown -R mysql:mysql data

4.启动新版本数据库

/opt/mysql5730/bin/mysqld_safe --defaults-file=/opt/mysql5730/conf/my.cnf --user=mysql &

查看启动日志,发型很多错误,但是数据库是可以启动的

2020-07-10T01:00:06.716719Z 0 [ERROR] Column count of performance_schema.table_lock_waits_summary_by_table is wrong. Expected 68, found 73. Created with MySQL 50640, now running 50730. Please use mysql_upgrade to fix this error.

2020-07-10T01:00:06.716918Z 0 [ERROR] Column count of performance_schema.threads is wrong. Expected 17, found 14. Created with MySQL 50640, now running 50730. Please use mysql_upgrade to fix this error.

2020-07-10T01:00:06.717159Z 0 [ERROR] Column count of performance_schema.events_stages_current is wrong. Expected 12, found 10. Created with MySQL 50640, now running 50730. Please use mysql_upgrade to fix this error.

2020-07-10T01:00:06.717394Z 0 [ERROR] Column count of performance_schema.events_stages_history is wrong. Expected 12, found 10. Created with MySQL 50640, now running 50730. Please use mysql_upgrade to fix this error.

2020-07-10T01:00:06.717585Z 0 [ERROR] Column count of performance_schema.events_stages_history_long is wrong. Expected 12, found 10. Created with MySQL 50640, now running 50730. Please use mysql_upgrade to fix this error.

2020-07-10T01:00:06.717950Z 0 [ERROR] Incorrect definition of table performance_schema.events_stages_summary_by_account_by_event_name: expected column 'USER' at position 0 to have type char(32), found type char(16).

2020-07-10T01:00:06.718236Z 0 [ERROR] Incorrect definition of table performance_schema.events_stages_summary_by_user_by_event_name: expected column 'USER' at position 0 to have type char(32), found type char(16).

2020-07-10T01:00:06.718897Z 0 [ERROR] Column count of performance_schema.events_statements_current is wrong. Expected 41, found 40. Created with MySQL 50640, now running 50730. Please use mysql_upgrade to fix this error.

2020-07-10T01:00:06.719204Z 0 [ERROR] Column count of performance_schema.events_statements_history is wrong. Expected 41, found 40. Created with MySQL 50640, now running 50730. Please use mysql_upgrade to fix this error.

2020-07-10T01:00:06.719513Z 0 [ERROR] Column count of performance_schema.events_statements_history_l

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值