mysql Headers 升级_mysql 升级方法

Performing an In-place Upgrade

This section describes how to perform an in-place upgrade. Review Before you Begin before proceeding.

Note

If you upgrade an installation originally produced by installing multiple RPM packages, upgrade all the packages, not just some. For example, if you previously installed the server and client RPMs, do not upgrade just the server RPM.

To perform an in-place upgrade:

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

Configure MySQL to perform a slow shutdown by setting innodb_fast_shutdown to 0. For example:

shell> bin/mysql -u root -p password --execute="set global innodb_fast_shutdown=0"

With a slow shutdown, InnoDB performs 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:

shell> bin/mysqladmin -u root -p password shutdown

Upgrade the MySQL binaries or packages in place, replacing the old binaries or packages with the new ones.

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

shell> bin/mysqld_safe --user=mysql --datadir=/path/to/existing-datadir

Run mysql_upgrade. For example:

shell> bin/mysql_upgrade -u root -p password

mysql_upgrade examines all tables in all databases for incompatibilities with the current version of MySQL. mysql_upgrade also upgrades the system tables so that you can take advantage of new privileges or capabilities.

Note

mysql_upgrade should not be used when the server is running with --gtid-mode=ON. See GTID mode and mysql_upgrade for more information.

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

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 in Section 2.11.1.1, “Changes Affecting Upgrades to MySQL 5.7” for steps to be performed before upgrading.

Export your existing data from the previous MySQL version:

shell> mysqldump --add-drop-table --routines --events

-> --all-databases --force > data-for-upgrade.sql

Note

Use the --routines and --events options with mysqldump (as shown above) if your databases include stored programs. The --all-databases option includes all databases in the dump, including the mysql database that holds the system tables.

Important

If you have tables that contain generated columns, use the mysqldump utility provided with MySQL 5.7.9 or higher to create your dump files. The mysqldump utility provided in earlier releases uses incorrect syntax for generated column definitions (Bug #20769542). You can use the INFORMATION_SCHEMA.COLUMNS table to identify tables with generated columns.

Shut down the old MySQL server. For example:

shell> bin/mysqladmin -u root -p password shutdown

Install MySQL 5.7. For installation instructions, see Chapter 2, Installing and Upgrading MySQL.

Initialize a new data directory:

shell> mysqld --initialize --datadir=/path/to/5.7-datadir

Copy the temporary 'root'@'localhost' password printed to your screen or written to your error log for later use.

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

shell> bin/mysqld_safe --user=mysql --datadir=/path/to/5.7-datadir

Reset the root password:

shell> mysql -u root -p

Enter password: ****

mysql> ALTER USER USER() IDENTIFIED BY 'your new password';

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

shell> bin/mysql -u root -p password --execute="source data-for-upgrade.sql" --force

Run mysql_upgrade. For example:

shell> bin/mysql_upgrade -u root -p password

mysql_upgrade examines all tables in all databases for incompatibilities with the current version of MySQL. mysql_upgrade also upgrades the system tables so that you can take advantage of new privileges or capabilities.

Note

mysql_upgrade should not be used when the server is running with --gtid-mode=ON. See GTID mode and mysql_upgrade for more information.

mysql_upgrade does not upgrade the contents of the help tables. For upgrade instructions, see Section 6.1.9, “Server-Side Help”.

Configure MySQL to perform a slow shutdown by setting innodb_fast_shutdown to 0. For example:

shell> bin/mysql -u root -p password --execute="set global innodb_fast_shutdown=0"

Shut down and restart the MySQL server to ensure a clean shutdown and startup. For example:

shell> bin/mysqladmin -u root -p password shutdown

shell> bin/mysqld_safe --user=mysql --datadir=/path/to/5.7-datadir

Upgrade Troubleshooting

If problems occur, such as that the new mysqld server does not start or that you cannot connect without a password, verify that you do not have an old my.cnf file from your previous installation. You can check this with the --print-defaults option (for example, mysqld --print-defaults). If this command displays anything other than the program name, you have an active my.cnf file that affects server or client operation.

If, after an upgrade, you experience problems with compiled client programs, such as Commands out of sync or unexpected core dumps, you probably have used old header or library files when compiling your programs. In this case, check the date for your mysql.h file andlibmysqlclient.a library to verify that they are from the new MySQL distribution. If not, recompile your programs with the new headers and libraries. Recompilation might also be necessary for programs compiled against the shared client library if the library major version number has changed (for example from libmysqlclient.so.15 to libmysqlclient.so.16.

If you have created a user-defined function (UDF) with a given name and upgrade MySQL to a version that implements a new built-in function with the same name, the UDF becomes inaccessible. To correct this, use DROP FUNCTION to drop the UDF, and then use CREATE FUNCTION to re-create the UDF with a different nonconflicting name. The same is true if the new version of MySQL implements a built-in function with the same name as an existing stored function. See Section 10.2.4, “Function Name Parsing and Resolution”, for the rules describing how the server interprets references to different kinds of functions.

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值