我们这里的环境是主从环境,我们将从库先升级到新的版本,然后将从库升级为主库,再升级原来的主库,完成主从环境的升级.
------------------------------------------从库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