check-for-server-upgrade参数用于运行MySQL升级前检查工具,扫描当前数据库(版本5.7.42)与目标版本(8.0.41)的兼容性,识别潜在问题(如表损坏、字符集不兼容、保留关键字冲突、系统变量默认值变更等),并生成详细报告以指导用户在升级前修复或调整配置。
./mysqlsh -S /tmp/mysql_mysql57_1.sock -- util check-for-server-upgrade
--config-path=/etc/my_57_1.cnf
The MySQL server at /tmp%2Fmysql_mysql57_1.sock, version 5.7.42-log - MySQL
Community Server (GPL), will now be checked for compatibility issues for
upgrade to MySQL 8.0.41...
1) Usage of old temporal type
No issues found
2) MySQL 8.0 syntax check for routine-like objects
No issues found
3) Usage of db objects with names conflicting with new reserved keywords
Warning: The following objects have names that conflict with new reserved
keywords. Ensure queries sent by your applications use `quotes` when
referring to them or they will result in errors.
More information:
https://dev.mysql.com/doc/refman/en/keywords.html
test.reserved_demo.window - Column name
4) Usage of utf8mb3 charset
Warning: The following objects use the utf8mb3 character set. It is
recommended to convert them to use utf8mb4 instead, for improved Unicode
support.
More information:
https://dev.mysql.com/doc/refman/8.0/en/charset-unicode-utf8mb3.html
aa - schema's default character set: utf8
--More--ERROR: 2 errors were found. Please correct these issues before upgrading to avoid compatibility issues.
cktest - schema's default character set: utf8
drc - schema's default character set: utf8
hcytest - schema's default character set: utf8
percona - schema's default character set: utf8
test - schema's default character set: utf8
test1 - schema's default character set: utf8
test2 - schema's default character set: utf8
percona.checksums.db - column's default character set: utf8
percona.checksums.tbl - column's default character set: utf8
percona.checksums.chunk_index - column's default character set: utf8
percona.checksums.lower_boundary - column's default character set: utf8
percona.checksums.upper_boundary - column's default character set: utf8
percona.checksums.this_crc - column's default character set: utf8
percona.checksums.master_crc - column's default character set: utf8
test.encrypted_data.salt - column's default character set: utf8
test.products.product_name - column's default character set: utf8
test.s.name - column's default character set: utf8
test.sbtest1.c - column's default character set: utf8
test.sbtest1.pad - column's default character set: utf8
test.scores.student_name - column's default character set: utf8
test.student.name - column's default character set: utf8
test.student.course_ids - column's default character set: utf8
test.students.name - column's default character set: utf8
test.t1.info - column's default character set: utf8
test.t2.name - column's default character set: utf8
test.t2.address - column's default character set: utf8
test.t8.address - column's default character set: utf8
test.t9.name - column's default character set: utf8
test.t9.city - column's default character set: utf8
test.test_json.name - column's default character set: utf8
test.test_no_pk.name - column's default character set: utf8
test.user.name - column's default character set: utf8
test2.A.name - column's default character set: utf8
test2.t1.name - column's default character set: utf8
test2.users.username - column's default character set: utf8
test2.users.email - column's default character set: utf8
5) Table names in the mysql schema conflicting with new tables in 8.0
No issues found
6) Partitioned tables using engines with non native partitioning
No issues found
7) Foreign key constraint names longer than 64 characters
No issues found
8) Usage of obsolete MAXDB sql_mode flag
No issues found
9) Usage of obsolete sql_mode flags
Notice: The following DB objects have obsolete options persisted for
sql_mode, which will be cleared during upgrade to 8.0.
More information:
https://dev.mysql.com/doc/refman/8.0/en/mysql-nutshell.html#mysql-nutshell-removals
test.insert_10000_records - PROCEDURE uses obsolete NO_AUTO_CREATE_USER
sql_mode
test.set_safe_updates_if_needed - PROCEDURE uses obsolete NO_AUTO_CREATE_USER
sql_mode
test.cleanup_expired_data - EVENT uses obsolete NO_AUTO_CREATE_USER sql_mode
test2.trg_after_insert_A - TRIGGER uses obsolete NO_AUTO_CREATE_USER sql_mode
test2.before_user_update - TRIGGER uses obsolete NO_AUTO_CREATE_USER sql_mode
global system variable sql_mode - defined using obsolete NO_AUTO_CREATE_USER
option
10) ENUM/SET column definitions containing elements longer than 255 characters
No issues found
11) Usage of partitioned tables in shared tablespaces
No issues found
12) Circular directory references in tablespace data file paths
No issues found
13) Usage of removed functions
No issues found
14) Usage of removed GROUP BY ASC/DESC syntax
No issues found
15) Removed system variables for error logging to the system log configuration
No issues found
16) Removed system variables
No issues found
17) System variables with new default values
Warning: Following system variables that are not defined in your
configuration file will have new default values. Please review if you rely on
their current values and if so define them before performing upgrade.
More information:
https://mysqlserverteam.com/new-defaults-in-mysql-8-0/
back_log - default value will change
collation_server - default value will change from latin1_swedish_ci to
utf8mb4_0900_ai_ci
event_scheduler - default value will change from OFF to ON
explicit_defaults_for_timestamp - default value will change from OFF to ON
innodb_autoinc_lock_mode - default value will change from 1 (consecutive) to
2 (interleaved)
innodb_flush_method - default value will change from NULL to fsync (Unix),
unbuffered (Windows)
innodb_flush_neighbors - default value will change from 1 (enable) to 0
(disable)
innodb_max_dirty_pages_pct - default value will change from 75 (%) 90 (%)
innodb_max_dirty_pages_pct_lwm - default value will change from_0 (%) to 10
(%)
innodb_undo_log_truncate - default value will change from OFF to ON
innodb_undo_tablespaces - default value will change from 0 to 2
log_error_verbosity - default value will change from 3 (Notes) to 2 (Warning)
max_allowed_packet - default value will change from 4194304 (4MB) to 67108864
(64MB)
max_error_count - default value will change from 64 to 1024
optimizer_trace_max_mem_size - default value will change from 16KB to 1MB
performance_schema_consumer_events_transactions_current - default value will
change from OFF to ON
performance_schema_consumer_events_transactions_history - default value will
change from OFF to ON
slave_rows_search_algorithms - default value will change from 'INDEX_SCAN,
TABLE_SCAN' to 'INDEX_SCAN, HASH_SCAN'
table_open_cache - default value will change from 2000 to 4000
transaction_write_set_extraction - default value will change from OFF to
XXHASH64
18) Zero Date, Datetime, and Timestamp values
No issues found
19) Schema inconsistencies resulting from file removal or corruption
Error: Following tables show signs that either table datadir directory or frm
file was removed/corrupted. Please check server logs, examine datadir to
detect the issue and fix it before upgrade
test.#sql-157ae_c - present in INFORMATION_SCHEMA's INNODB_SYS_TABLES table
but missing from TABLES table
test.#sql-865c_3 - present in INFORMATION_SCHEMA's INNODB_SYS_TABLES table
but missing from TABLES table
20) Tables recognized by InnoDB that belong to a different engine
No issues found
21) Issues reported by 'check table x for upgrade' command
No issues found
22) New default authentication plugin considerations
Warning: The new default authentication plugin 'caching_sha2_password' offers
more secure password hashing than previously used 'mysql_native_password'
(and consequent improved client connection authentication). However, it also
has compatibility implications that may affect existing MySQL installations.
If your MySQL installation must serve pre-8.0 clients and you encounter
compatibility issues after upgrading, the simplest way to address those
issues is to reconfigure the server to revert to the previous default
authentication plugin (mysql_native_password). For example, use these lines
in the server option file:
[mysqld]
default_authentication_plugin=mysql_native_password
However, the setting should be viewed as temporary, not as a long term or
permanent solution, because it causes new accounts created with the setting
in effect to forego the improved authentication security.
If you are using replication please take time to understand how the
authentication plugin changes may impact you.
More information:
https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password-compatibility-issues
https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password-replication
23) Columns which cannot have default values
No issues found
24) Check for invalid table names and schema names used in 5.7
No issues found
25) Check for orphaned routines in 5.7
No issues found
26) Check for deprecated usage of single dollar signs in object names
No issues found
27) Check for indexes that are too large to work on higher versions of MySQL
Server than 5.7
No issues found
28) Check for deprecated '.<table>' syntax used in routines.
No issues found
29) Check for columns that have foreign keys pointing to tables from a diffrent
database engine.
No issues found
Errors: 2
Warnings: 59
Notices: 6
这份报告通过mysqlsh util.checkForServerUpgrade()检查了MySQL服务器从5.7.42升级到8.0.41的兼容性,扫描了数据库对象、配置和系统变量等方面。结果显示:
报告中明确指出2个错误,具体如下:
DROP
TABLE test.`#sql-157ae_c`; DROP
TABLE test.`#sql-865c_3`;
这份检查报告表明,你的MySQL 5.7.42服务器升级到8.0.41前,必须优先解决2个错误(表test.#sql-157ae_c和test.#sql-865c_3的文件损坏问题)。其他警告和通知可根据业务需求选择性处理。建议先备份数据,修复错误后再重新运行检查,确保升级顺利。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。