mysql 小版本升级_mysql版本升级

本文详细介绍了如何进行MySQL的小版本升级,包括在位升级和逻辑升级。在位升级涉及设置innodb_fast_shutdown为0以确保数据文件准备就绪,升级二进制文件或包,然后使用mysql_upgrade检查并更新系统数据库。逻辑升级则需要导出现有数据,安装新版本MySQL,初始化新数据目录,再导入数据。在升级过程中要注意不要在GTID模式下使用mysql_upgrade,并且帮助表的内容不会被升级。
摘要由CSDN通过智能技术生成

To perform an in-place upgrade:

Review the changes described inSection 2.11.1.1, “Changes Affecting Upgrades to MySQL 5.6”for steps to be performed before upgrading.

If you useInnoDB, configure MySQL to perform a slow shutdown by settinginnodb_fast_shutdownto0. For example:

mysql -u root -p --execute="SET GLOBAL innodb_fast_shutdown=0"

With a slow shutdown,InnoDBperforms a full purge and change buffer merge before shutting down, which ensures that data files are fully prepared in case of file format differences between releases.

Shut down the old MySQL server. For example:

mysqladmin -u root -p shutdown

Upgrade the MySQL binaries or packages in place (replace the old binaries or packages with the new ones).

Start the MySQL 5.6 server, using the existing data directory. For example:

mysqld_safe --user=mysql --datadir=/path/to/existing-datadir

Runmysql_upgrade. For example:

mysql_upgrade -u root -p

mysql_upgradeexamines all tables in all databases for incompatibilities with the current version of MySQL.mysql_upgradealso upgrades themysqlsystem database so that you can take advantage of new privileges or capabilities.

Note

mysql_upgradeshould not be used when the server is running with--gtid-mode=ON. SeeGTID mode and mysql_upgradefor more information.

mysql_upgradedoes not upgrade the contents of the help tables. For upgrade instructions, seeSection 5.1.10, “Server-Side Help”.

Shut down and restart the MySQL server to ensure that any changes made to the system tables take effect. For example:

mysqladmin -u root -p shutdownmysqld_safe --user=mysql --datadir=/path/to/existing-datadir

This section describes how to perform alogical upgrade. ReviewBefore you Beginbefore proceeding.

To perform a logical upgrade:

Review the changes described inSection 2.11.1.1, “Changes Affecting Upgrades to MySQL 5.6”for steps to be performed before upgrading.

Export your existing data from the previous MySQL version:

mysqldump -u root -p

--add-drop-table --routines --events

--all-databases --force > data-for-upgrade.sql   #mysql备份脚本

Note

Use the--routinesand--eventsoptions withmysqldump(as shown above) if your databases include stored programs. The--all-databasesoption includes all databases in the dump, including themysqldatabase that holds the system tables.

Shut down the old MySQL server. For example:

mysqladmin -u root -p shutdown

Install MySQL 5.6. For installation instructions, seeChapter 2,Installing and Upgrading MySQL.

Initialize a new data directory, as described atSection 2.10.1, “Initializing the Data Directory”. For example:

scripts/mysql_install_db --user=mysql --datadir=/path/to/5.6-datadir

Start the MySQL 5.6 server, using the new data directory. For example:

mysqld_safe --user=mysql --datadir=/path/to/5.6-datadir

Load the previously created dump file into the new MySQL server. For example:

mysql -u root -p --force < data-for-upgrade.sql

Runmysql_upgrade. For example:

mysql_upgrade -u root -p

mysql_upgradeexamines all tables in all databases for incompatibilities with the current version of MySQL.mysql_upgradealso upgrades themysqlsystem database so that you can take advantage of new privileges or capabilities.

Note

mysql_upgradeshould not be used when the server is running with--gtid-mode=ON. SeeGTID mode and mysql_upgradefor more information.

mysql_upgradedoes not upgrade the contents of the help tables. For upgrade instructions, seeSection 5.1.10, “Server-Side Help”.

Shut down and restart the MySQL server to ensure that any changes made to the system tables take effect. For example:

mysqladmin -u root -p shutdownmysqld_safe --user=mysql --datadir=/path/to/5.6-datadir

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值