mysql版本升级

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

Performing a Logical Upgrade

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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容