tencent cloud

TencentDB for MySQL

Release Notes and Announcements
Release Notes
Product Announcements
User Tutorial
Product Introduction
Overview
Strengths
Use Cases
Database Architecture
Resource Isolation Policy
Economical Instance
Feature List
Database Instance
High Availability (Multi-AZ)
Regions and AZs
Service Regions and Service Providers
Kernel Features
Overview
Kernel Version Release Notes
Functionality Features
Performance Features
Security Features
Stability Features
TXRocks Engine
LibraDB Engine
Checking and Fixing Kernel Issues
Purchase Guide
Billing Overview
Selection Guide
Purchase Methods
Renewal
Payment Overdue
Refund
Pay-as-You-Go to Monthly Subscription
Instance Adjustment Fee
Backup Space Billing
Database Audit Billing Overview
Commercial Billing and Activity Description for Database Proxy
Description of the Database Proxy Billing Cycle
Viewing Bills
Getting Started
Overview
Creating MySQL Instance
Connecting to MySQL Instance
SQL Insight (Database Audit)
Overview
Viewing Audit Instance List
Enabling Audit Service
Viewing Audit Log
Log Shipping
Configuring Post-Event Alarms
Modifying Audit Rule
Modifying Audit Services
Disabling Audit Service
Audit Rule Template
SQL Audit Rule (Legacy)
Viewing Audit Task
Authorizing Sub-User to Use Database Audit
MySQL Cluster Edition
Introduction to TencentDB for MySQL Cluster Edition
Creating TencentDB for MySQL Cluster Edition Instance
Maintenance Management Instance
Viewing Instance Monitoring
Adjusting Instance Configuration
Operations for Other Features
Migrate or upgrade to TencentDB for MySQL Cluster Edition
Operation Guide
Use Limits
Operation Overview
Instance Management and Maintenance
Instance Upgrade
CPU Elastic Expansion
Read-Only/Disaster Recovery Instances
Database Proxy
Database Management Center (DMC)
Account Management
Parameter Configuration
Backup and Rollback
Data Migration
Network and Security
Monitoring and Alarms
Log Center
Read-Only Analysis Engine
Tag
Practical Tutorial
Using TencentDB for MySQL to Upgrade MySQL 5.7 to MySQL 8.0
Methods and Instructions for Upgrading from MySQL 5.6 to MySQL 5.7
Cybersecurity Classified Protection Practice for Database Audit of TencentDB for MySQL
Building All-Scenario High-Availability Architecture
Usage Specifications of TencentDB for MySQL
Configuring Automatic Application Reconnection
Impact of Modifying MySQL Source Instance Parameters
Limits on Automatic Conversion from MyISAM to InnoDB
Creating VPCs for TencentDB for MySQL
Enhancing Business Load Capacity with TencentDB for MySQL
Setting up 2-Region-3-DC Disaster Recovery Architecture
Improving TencentDB for MySQL Performance with Read/Write Separation
Migrating Data from InnoDB to RocksDB with DTS
Building LAMP Stack for Web Application
Building Drupal Website
Calling MySQL APIs in Python
The primary and secondary instances have inconsistent query data
White Paper
Performance White Paper
Security White Paper
Troubleshooting
Connections
Performance
Instance Data Sync Delay
Failure to Enable Case Insensitivity
Failure to Obtain slow_query_log_file via a Command
API Documentation
History
Introduction
API Category
Instance APIs
Making API Requests
Data Import APIs
Database Proxy APIs
Database Audit APIs
Security APIs
Task APIs
Backup APIs
Account APIs
Rollback APIs
Parameter APIs
Database APIs
Monitoring APIs
Log-related API
Data Types
Error Codes
FAQs
Related to Selection
Billing
Backup
Rollback
Connection and Login
Parameter Modifications
Instance Upgrade
Account Permissions
Performance and Memory
Ops
Data Migration
Features
Console Operations
Logs
Event
Database audit
Instance Switch Impact
API 2.0 to 3.0 Switch Guide
Service Agreement
Service Level Agreement
Terms of Service
Reference
Standards and Certifications
Contact Us
Glossary
DocumentationTencentDB for MySQLOperation GuideInstance UpgradePre-Check and Bug Fixes Guide for Upgrading from MySQL 5.7 to MySQL 8.0

Pre-Check and Bug Fixes Guide for Upgrading from MySQL 5.7 to MySQL 8.0

PDF
Focus Mode
Font Size
Last updated: 2026-01-06 16:39:51

Contents

1. InnoDB Internal Structure Check

1.1 Legacy Temporal Format (oldTemporalCheck)

Error message: Usage of old temporal type
Error level: ERROR.

Error Cause

MySQL 5.5 and earlier versions used an old temporal type disk storage format. This format is no longer supported in MySQL 8.0 and must be converted to the new format before upgrading.

Technical Background

Problem
Description
Affected Data Types
TIME, DATETIME, TIMESTAMP
Characteristics of the Old Format
The column type display contains "5.5 binary format".
Reasons for Incompatibility
MySQL 8.0 has completely removed support for the old temporal format.

Detection Method

SELECT table_schema, table_name, column_name, column_type
FROM information_schema.columns
WHERE column_type LIKE '%5.5 binary format%';

Solution

-- Rebuild each detected table
ALTER TABLE database_name.table_name FORCE;

1.2 Schema Inconsistency Check (schemaInconsistencyCheck)

Error message: Schema inconsistencies resulting from file removal or corruption.
Error level: ERROR.

Error Cause

The table's data file (.ibd) or metadata file (.frm) was accidentally removed or corrupted, resulting in inconsistencies between the InnoDB data dictionary and MySQL metadata.

Technical Background

Problem
Description
Common Causes
Manual deletion of data files, disk failures, file system errors
Manifestations
The table exists in the InnoDB data dictionary but not in information_schema.tables.
Upgrade Impacts
The new data dictionary in MySQL 8.0 is unable to correctly migrate these inconsistent tables.

Detection Method

-- Find records that exist in InnoDB but not in the TABLES table
SELECT t.NAME as table_name
FROM information_schema.innodb_sys_tables t
LEFT JOIN information_schema.tables it
ON CONCAT(it.TABLE_SCHEMA, '/', it.TABLE_NAME) = t.NAME
WHERE it.TABLE_NAME IS NULL
AND t.NAME NOT LIKE 'SYS_%'
AND t.NAME NOT LIKE 'mysql/%';

Solution

1. Check the error log:
grep -i "corrupt\\|missing\\|error" /var/log/mysql/error.log
2. Check the data directory:
ls -la /var/lib/mysql/database_name/
3. Solutions (Select as appropriate):
-- If the table is indeed no longer needed, clean up the InnoDB data dictionary
-- Need to create an empty table with the same name and then delete it
CREATE TABLE database_name.table_name (id INT) ENGINE=InnoDB;
DROP TABLE database_name.table_name;

-- If data recovery is needed, attempt to restore from backup

1.3 Old Geometry Type Check (oldGeometryCheck)

Error message: Spatial data columns created in MySQL 5.6.
Error Level: ERROR (not applicable to 8.0.24+).

Error Cause

Spatial data columns created in MySQL 5.6 use the old storage format. MySQL 8.0 versions prior to 8.0.24 do not support direct upgrades of these tables.

Technical Background

Problem
Description
Affected Data Types
POINT, GEOMETRY, POLYGON, LINESTRING, MULTIPOINT, MULTILINESTRING, MULTIPOLYGON, GEOMETRYCOLLECTION
Version Limitations
Versions prior to 8.0.24 cannot upgrade these tables.
Recommended Solution
Directly upgrade to version 8.0.24 or newer

Solution

Option 1: Directly upgrade to MySQL 8.0.24+ (Recommended)
The correspondence between the Community Edition and TencentDB for MySQL kernel versions can be found in TXSQL Engine Kernel Version Updates. For operations on upgrading the TencentDB for MySQL kernel version, refer to Upgrading Kernel Minor Versions.
Option 2: Rebuild affected tables before upgrading
-- Find affected tables
SELECT table_schema, table_name, column_name, data_type
FROM information_schema.columns
WHERE data_type IN ('point', 'geometry', 'polygon', 'linestring',
'multipoint', 'multilinestring', 'multipolygon',
'geometrycollection');

-- Rebuild table
ALTER TABLE database_name.table_name FORCE;

1.4 Instant DDL Incompatibility (CHECK TABLE FOR UPGRADE)

Error Message: has done instant ddl, cannot upgrade to 8.0.
Error level: ERROR.

Error Cause

This error occurs because some tables in your MySQL 5.7 database have undergone Instant DDL operations (primarily the INSTANT ADD COLUMN feature), and the metadata format generated by such operations is incompatible with MySQL 8.0.

Technical Background

Problem
Description
What is Instant DDL
A feature for quickly adding columns that modifies only the table's metadata without rewriting the table data, enabling column addition operations to be completed within seconds.
Reasons for Incompatibility
MySQL 5.7 (specific cloud vendor versions) and MySQL 8.0 have different implementations of Instant DDL, resulting in variations in data dictionary formats.
Changes in MySQL 8.0
MySQL 8.0 has redesigned the data dictionary structure, introducing new mechanisms such as row_version, which cannot correctly parse the legacy Instant DDL metadata from MySQL 5.7.

Solution

Affected tables need to be rebuilt before the upgrade is performed to remove Instant DDL metadata:
-- 1. Check which tables have undergone Instant DDL
SELECT b.name from information_schema.INNODB_SYS_INSTANT_COLS a join information_schema.INNODB_SYS_TABLES b on a.table_id=b.table_id;

-- 2. Check which tables have undergone modify column
SELECT b.name from information_schema.INNODB_SYS_INSTANT_MODIFIED_COLS a join information_schema.INNODB_SYS_TABLES b on a.table_id=b.table_id;

-- 3. Rebuild these tables (choose one of the following)
-- Method 1:
OPTIMIZE TABLE database_name.table_name;

-- Method 2:
ALTER TABLE database_name.table_name ENGINE=InnoDB;
After the rebuild is completed, the table data will be rewritten to the standard format, the Instant DDL metadata is cleared, and executing the upgrade check again will pass.

1.5 CHECK TABLE FOR UPGRADE Check (checkTableOutput)

Error message: Issues reported by 'check table x for upgrade' command.
Error level: dynamic (ERROR/WARNING/NOTICE).

Error Cause

MySQL Shell will execute the CHECK TABLE ... FOR UPGRADE command for all non-system tables, which detects various potential issues in the tables.

Solution

-- Manually perform the check
CHECK TABLE database_name.table_name FOR UPGRADE;

-- Fix based on the specific error message returned
-- Common fixes:
REPAIR TABLE database_name.table_name;
-- or
ALTER TABLE database_name.table_name FORCE;

2. Database Object Definition Check

2.1 Stored Procedure/Function Syntax Check (routinesSyntaxCheck)

Error message: MySQL 8.0 syntax check for routine-like objects.
Error level: ERROR.

Error Cause

The definitions of stored procedures, functions, triggers, or events contain MySQL 8.0 incompatible syntax, with the most common cause being identifiers conflicting with new reserved keywords.

Technical Background

Problem
Description
Check object
Stored procedures, functions, triggers, events
Common Causes
Using new version reserved keywords as identifiers
Detection method
Validate definitions using the MySQL 8.0 syntax parser

Solution

-- 1. View stored procedures/functions definitions
SHOW CREATE PROCEDURE database_name.procedure_name;
SHOW CREATE FUNCTION database_name.function_name;

-- 2. Add backticks to conflicting identifiers
-- BEFORE MODIFICATION
CREATE PROCEDURE test()
BEGIN
SELECT rank FROM users; -- rank is a reserved word in MySQL 8.0
END;

-- AFTER MODIFICATION
CREATE PROCEDURE test()
BEGIN
SELECT `rank` FROM users;
END;

-- 3. Recreate the stored procedure
DROP PROCEDURE IF EXISTS database_name.procedure_name;
CREATE PROCEDURE database_name.procedure_name ...

2.2 Reserved Keywords Conflict Check (reservedKeywordsCheck)

Error message: Usage of db objects with names conflicting with new reserved keywords
Error level: WARNING.

Error Cause

The names of database objects (Schema, table, column, trigger, view, stored procedure, event) conflict with newly added reserved keywords in MySQL 8.0.

Technical Background

Newly added reserved keywords in various editions of MySQL 8.0:
Edition
Newly Added Reserved Keywords
8.0.11
ADMIN, CUBE, CUME_DIST, DENSE_RANK, EMPTY, EXCEPT, FIRST_VALUE, FUNCTION, GROUPING, GROUPS, JSON_TABLE, LAG, LAST_VALUE, LEAD, NTH_VALUE, NTILE, OF, OVER, PERCENT_RANK, PERSIST, PERSIST_ONLY, RANK, RECURSIVE, ROW, ROWS, ROW_NUMBER, SYSTEM, WINDOW
8.0.14
LATERAL
8.0.17
ARRAY, MEMBER
8.0.31
FULL, INTERSECT

Solution

-- 1. Find objects using reserved keywords
SELECT table_schema, table_name, column_name
FROM information_schema.columns
WHERE column_name IN ('RANK', 'ROWS', 'GROUPS', 'FUNCTION', 'SYSTEM', ...);

-- 2. Modify the SQL in user applications by adding backticks to these identifiers
-- BEFORE MODIFICATION
SELECT rank, rows FROM my_table;

-- AFTER MODIFICATION
SELECT `rank`, `rows` FROM my_table;

-- 3. Or rename the objects (if feasible)
ALTER TABLE my_table CHANGE rank ranking INT;

2.3 Character Set Check (utf8mb3Check)

Error message: Usage of utf8mb3 charset
Error level: WARNING.

Error Cause

The database or table uses utf8 (that is, utf8mb3) character set. In MySQL 8.0, utf8mb3 has been deprecated, and it is recommended to use utf8mb4.

Technical Background

Problem
Description
utf8mb3 limitation
utf8mb3 can only store up to 3-byte UTF-8 characters.
utf8mb4 advantages
Supports full Unicode, including emoji.
Changes in MySQL 8.0
utf8 alias will point to utf8mb4 in future versions.

Solution

-- 1. Find objects using utf8/utf8mb3
SELECT table_schema, table_name, column_name, character_set_name
FROM information_schema.columns
WHERE character_set_name IN ('utf8', 'utf8mb3') and table_schema not in ('information_schema','mysql','performance_schema','sys');

-- 2. Convert database character set
ALTER DATABASE database_name CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- 3. Convert table character set
ALTER TABLE database_name.table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- 4. Batch conversion script
SELECT CONCAT('ALTER TABLE `', table_schema, '`.`', table_name,
'` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;')
FROM information_schema.tables
WHERE table_schema NOT IN ('mysql', 'information_schema', 'performance_schema', 'sys')
AND table_collation LIKE 'utf8_%';

2.4 MySQL Schema Table Name Conflict Check (mysqlSchemaCheck)

Error message: Table names in the mysql schema conflicting with new tables in 8.0
Error level: ERROR.

Error Cause

mysql system database contains user tables with the same name as the newly added system tables in MySQL 8.0.

Technical Background

Newly added system table names in MySQL 8.0:
catalogs, character_sets, collations, column_type_elements, columns,
dd_properties, events, foreign_key_column_usage, foreign_keys,
index_column_usage, index_partitions, index_stats, indexes,
parameter_type_elements, parameters, routines, schemata,
st_spatial_reference_systems, table_partition_values, table_partitions,
table_stats, tables, tablespace_files, tablespaces, triggers,
view_routine_usage, view_table_usage, component, default_roles,
global_grants, innodb_ddl_log, innodb_dynamic_metadata,
password_history, role_edges

Solution

-- 1. Find conflicting tables
SELECT table_name
FROM information_schema.tables
WHERE table_schema = 'mysql'
AND table_name IN ('catalogs', 'character_sets', 'collations', ...);

-- 2. Rename conflicting tables
RENAME TABLE mysql.conflicting_table_name TO mysql.conflicting_table_name_backup;

-- or move to other databases
RENAME TABLE mysql.conflicting_table_name TO other_db.table_name;

2.5 Foreign Key Constraint Name Length Check (foreignKeyLengthCheck)

Error message: Foreign key constraint names longer than 64 characters
Error level: ERROR.

Error Cause

The foreign key constraint name exceeds 64 characters. MySQL 8.0 strictly restricts constraint name length to 64 characters.

Solution

-- 1. Find constraint names exceeding the length limit
SELECT i.TABLE_SCHEMA, i.TABLE_NAME, i.CONSTRAINT_NAME,
LENGTH(i.CONSTRAINT_NAME) as name_length
FROM information_schema.TABLE_CONSTRAINTS i
WHERE i.CONSTRAINT_TYPE = 'FOREIGN KEY'
AND LENGTH(i.CONSTRAINT_NAME) > 64;

-- 2. Recreate the foreign key constraint
-- Delete the old constraint first
ALTER TABLE database_name.table_name DROP FOREIGN KEY old_constraint_name;

-- Then create a new constraint (using a shorter name)
ALTER TABLE database_name.table_name
ADD CONSTRAINT new_constraint_name FOREIGN KEY (column_name) REFERENCES referenced_table(referenced_column);

2.6 MAXDB SQL Mode Check (maxdbFlagCheck)

Error message: Usage of obsolete MAXDB sql_mode flag.
Error level: WARNING.

Error Cause

Stored procedures, events, or triggers have persisted the deprecated MAXDB sql_mode option.

Technical Background

Problem
Description
MAXDB Mode Purpose
Make DATETIME behave like TIMESTAMP.
Upgrade Impacts
MySQL 8.0 automatically clears this mode, which may affect date handling for dates before 1970 or after 2037.

Solution

-- 1. Identify objects using the MAXDB mode
SELECT ROUTINE_SCHEMA, ROUTINE_NAME, SQL_MODE
FROM information_schema.ROUTINES
WHERE SQL_MODE LIKE '%MAXDB%';

-- 2. Recreate the stored procedure, removing the MAXDB mode
-- Export stored procedure definition
SHOW CREATE PROCEDURE database_name.procedure_name;

-- Modify SQL_MODE, remove MAXDB
-- Recreate the stored procedure

2.7 Obsolete SQL Mode Flag Check (sqlModeFlagCheck)

Error message: Usage of obsolete sql_mode flags.
Error level: NOTICE.

Error Cause

Objects contain sql_mode flags that have been removed in MySQL 8.0.

Technical Background

Removed sql_mode flags:
DB2
MSSQL
MYSQL323
MYSQL40
NO_AUTO_CREATE_USER
NO_FIELD_OPTIONS
NO_KEY_OPTIONS
NO_TABLE_OPTIONS
ORACLE
POSTGRESQL

Solution

-- 1. Find objects using obsolete modes
SELECT ROUTINE_SCHEMA, ROUTINE_NAME, SQL_MODE
FROM information_schema.ROUTINES
WHERE SQL_MODE REGEXP 'DB2|MSSQL|MYSQL323|MYSQL40|NO_AUTO_CREATE_USER|ORACLE|POSTGRESQL';

-- 2. Recreate the object, removing obsolete sql_mode flags

2.8 ENUM/SET Element Length Check (enumSetElementLenghtCheck)

Error message: ENUM/SET column definitions containing elements longer than 255 characters.
Error level: ERROR.

Error Cause

ENUM or SET columns contain element values exceeding 255 characters.

Solution

-- 1. Find elements exceeding the length limit
SELECT table_schema, table_name, column_name, data_type, character_maximum_length
FROM information_schema.columns
WHERE data_type IN ('enum', 'set')
AND character_maximum_length > 255 and table_schema not in ('information_schema','mysql','performance_schema','sys');

-- 2. Modify column definitions to shorten element values
ALTER TABLE database_name.table_name
MODIFY COLUMN column_name ENUM('short_value1', 'short_value2', ...);

2.9 Removed Functions Check (removedFunctionsCheck)

Error message: Usage of removed functions
Error level: ERROR.

Error Cause

Views, stored procedures/functions, generated columns, triggers, or events use functions that have been removed in MySQL 8.0.

Technical Background

Removed functions and their alternatives:
Removed Functions
Alternative Solution
ENCODE()
AES_ENCRYPT()
DECODE()
AES_DECRYPT()
ENCRYPT()
SHA2()
DES_ENCRYPT()
AES_ENCRYPT()
DES_DECRYPT()
AES_DECRYPT()
PASSWORD()
No direct alternative; use application-layer encryption.
AREA()
ST_AREA()
ASBINARY()
ST_ASBINARY()
ASTEXT()
ST_ASTEXT()
BUFFER()
ST_BUFFER()
CENTROID()
ST_CENTROID()
CONTAINS()
MBRCONTAINS() or ST_CONTAINS()
CROSSES()
ST_CROSSES()
DIMENSION()
ST_DIMENSION()
DISJOINT()
MBRDISJOINT() or ST_DISJOINT()
DISTANCE()
ST_DISTANCE()
ENDPOINT()
ST_ENDPOINT()
ENVELOPE()
ST_ENVELOPE()
EQUALS()
MBREQUALS() or ST_EQUALS()
EXTERIORRING()
ST_EXTERIORRING()
GEOMCOLLFROMTEXT()
ST_GEOMCOLLFROMTEXT()
GEOMCOLLFROMWKB()
ST_GEOMCOLLFROMWKB()
GEOMETRYCOLLECTION()
ST_GEOMETRYCOLLECTION()
GEOMETRYN()
ST_GEOMETRYN()
GEOMETRYTYPE()
ST_GEOMETRYTYPE()
GEOMFROMTEXT()
ST_GEOMFROMTEXT()
GEOMFROMWKB()
ST_GEOMFROMWKB()
GLENGTH()
ST_LENGTH()
INTERIORRINGN()
ST_INTERIORRINGN()
INTERSECTS()
MBRINTERSECTS() or ST_INTERSECTS()
ISCLOSED()
ST_ISCLOSED()
ISEMPTY()
ST_ISEMPTY()
ISSIMPLE()
ST_ISSIMPLE()
LINEFROMTEXT()
ST_LINEFROMTEXT()
LINEFROMWKB()
ST_LINEFROMWKB()
LINESTRING()
ST_LINESTRING()
MLINEFROMTEXT()
ST_MLINEFROMTEXT()
MLINEFROMWKB()
ST_MLINEFROMWKB()
MPOINTFROMTEXT()
ST_MPOINTFROMTEXT()
MPOINTFROMWKB()
ST_MPOINTFROMWKB()
MPOLYFROMTEXT()
ST_MPOLYFROMTEXT()
MPOLYFROMWKB()
ST_MPOLYFROMWKB()
MULTILINESTRING()
ST_MULTILINESTRING()
MULTIPOINT()
ST_MULTIPOINT()
MULTIPOLYGON()
ST_MULTIPOLYGON()
NUMGEOMETRIES()
ST_NUMGEOMETRIES()
NUMINTERIORRINGS()
ST_NUMINTERIORRINGS()
NUMPOINTS()
ST_NUMPOINTS()
OVERLAPS()
MBROVERLAPS() or ST_OVERLAPS()
POINTFROMTEXT()
ST_POINTFROMTEXT()
POINTFROMWKB()
ST_POINTFROMWKB()
POINTN()
ST_POINTN()
POLYFROMTEXT()
ST_POLYFROMTEXT()
POLYFROMWKB()
ST_POLYFROMWKB()
POLYGON()
ST_POLYGON()
SRID()
ST_SRID()
STARTPOINT()
ST_STARTPOINT()
TOUCHES()
ST_TOUCHES()
WITHIN()
MBRWITHIN() or ST_WITHIN()
X()
ST_X()
Y()
ST_Y()

Solution

-- 1. Find views that use removed functions
SELECT table_schema, table_name, view_definition
FROM information_schema.views
WHERE view_definition REGEXP 'ENCODE|DECODE|ENCRYPT|PASSWORD|\\\\bAREA\\\\b|\\\\bASBINARY\\\\b'
and table_schema not in ('information_schema','mysql','performance_schema','sys');

-- 2. Modify the view definition to use alternative functions
CREATE OR REPLACE VIEW view_name AS
SELECT ST_AREA(geom_column) AS area -- Replace AREA()
FROM table_name;

-- 3. Similarly modify stored procedures, triggers, etc.

2.10 GROUP BY ASC/DESC Syntax Check (groupByAscCheck)

Error message: Usage of removed GROUP BY ASC/DESC syntax
Error level: ERROR.

Error Cause

Views, stored procedures/functions, triggers, or events use the removed GROUP BY ... ASC/DESC syntax.

Technical Background

Problem
Description
legacy syntax
GROUP BY column ASC or GROUP BY column DESC
Changes in MySQL 8.0
GROUP BY no longer supports the ASC/DESC modifiers.
Correct Practices
Sorting should be done using the ORDER BY clause.

Solution

-- BEFORE MODIFICATION (Incorrect)
SELECT category, COUNT(*)
FROM products
GROUP BY category DESC;

-- AFTER MODIFICATION (Correct)
SELECT category, COUNT(*)
FROM products
GROUP BY category
ORDER BY category DESC;

2.11 Zero Date Check (zeroDatesCheck)

Error message: Zero Date, Datetime, and Timestamp values.
Error level: WARNING.

Error Cause

The database contains zero date values (such as 0000-00-00), or the sql_mode does not include NO_ZERO_DATE and NO_ZERO_IN_DATE.

Technical Background

Problem
Description
Default Behavior Changes
MySQL 8.0 does not allow zero date values by default.
Impact Scope
Column default values, existing data
sql_mode changes
NO_ZERO_DATE and NO_ZERO_IN_DATE are enabled by default.

Solution

-- 1. Find columns using zero date default values
SELECT table_schema, table_name, column_name, column_default
FROM information_schema.columns
WHERE column_default LIKE '0000-00-00%'
and table_schema not in ('information_schema','mysql','performance_schema','sys');

-- 2. Find data containing zero dates
SELECT COUNT(*) FROM table_name WHERE date_column = '0000-00-00';

-- 3. Update zero dates to valid values
UPDATE table_name SET date_column = '1970-01-01' WHERE date_column = '0000-00-00';

-- 4. Modify column default values
ALTER TABLE table_name ALTER COLUMN date_column SET DEFAULT '1970-01-01';
-- or
ALTER TABLE table_name ALTER COLUMN date_column SET DEFAULT CURRENT_TIMESTAMP;

2.12 FTS Table Name Check (ftsTablenameCheck)

Error message: Table names containing 'FTS'
Error Level: ERROR (not applicable to 8.0.18+ or Windows).

Error Cause

Table names containing the string 'FTS' (case-sensitive). This conflicts with the internal table naming conventions for InnoDB full-text indexes.

Solution

-- 1. Find table names containing 'FTS'
SELECT table_schema, table_name
FROM information_schema.tables
WHERE table_name LIKE BINARY '%FTS%';

-- 2. Temporarily rename before upgrade (by changing any letter to lowercase)
RENAME TABLE myFTStable TO myFtStable;

-- 3. Can revert to original name after upgrade completion
RENAME TABLE myFtStable TO myFTStable;

2.13 Generated Column Function Semantic Change Check (changedFunctionsInGeneratedColumnsCheck)

Error message: Indexes on functions with changed semantics
Error level: WARNING.

Error Cause

Generated columns have indexes, and these generated columns use functions whose semantics have changed (such as CAST and CONVERT).

Technical Background

Problem
Description
Influence Functions
CAST, CONVERT
Potential Issues
May cause replication issues and index corruption.
Applicable Versions
Upgrade to 8.0.28+ requires attention

Solution

-- 1. Find affected generated columns
SELECT table_schema, table_name, column_name, generation_expression
FROM information_schema.columns
WHERE generation_expression IS NOT NULL
AND generation_expression REGEXP 'CAST|CONVERT' and table_schema not in ('information_schema','mysql','performance_schema','sys');

-- 2. Rebuild index
ALTER TABLE table_name DROP INDEX index_name;
ALTER TABLE table_name ADD INDEX index_name (generated_column_name);

2.14 Invalid MySQL 5.7 Name Check ((mysqlInvalid57NamesCheck)

Error message: Check for invalid table names and schema names used in 5.7
Error level: ERROR.

Error Cause

There exist schemas or table names starting with #mysql50#, which is a legacy naming convention from MySQL 5.0.

Solution

-- 1. Use mysqlcheck to repair
mysqlcheck --check-upgrade --all-databases
mysqlcheck --fix-db-names --fix-table-names --all-databases

-- 2. Or use SQL commands
ALTER DATABASE `#mysql50#old_name` UPGRADE DATA DIRECTORY NAME;

2.15 Orphaned Stored Procedures Check (mysqlOrphanedRoutinesCheck)

Error message: Check for orphaned routines in 5.7
Error level: ERROR.

Error Cause

Stored procedures or functions referencing schemas that no longer exist have become "orphaned".

Solution

-- 1. Find orphaned stored procedures
SELECT ROUTINE_SCHEMA, ROUTINE_NAME, 'is orphaned'
FROM information_schema.routines
WHERE NOT EXISTS (
SELECT SCHEMA_NAME
FROM information_schema.schemata
WHERE ROUTINE_SCHEMA = SCHEMA_NAME
);

-- 2. Delete orphaned stored procedures
DROP PROCEDURE IF EXISTS non-existent_schema.procedure_name;
DROP FUNCTION IF EXISTS non-existent_schema.function_name;

2.16 Dollar Sign Name Check (mysqlDollarSignNameCheck)

Error message: Check for deprecated usage of single dollar signs in object names
Error level: WARNING.

Error Cause

Object names begin with the dollar sign $ but do not end with $, this is a deprecated usage.

Solution

-- Modify the object names to end with $
-- For example: change $example to $example$ or example
RENAME TABLE `$mytable` TO `$mytable$`;
-- or
RENAME TABLE `$mytable` TO `mytable`;

2.17 Index Too Large Check (mysqlIndexTooLargeCheck)

Error message: Check for indexes that are too large to work on higher versions of MySQL Server than 5.7
Error level: ERROR.

Error Cause

Indexes created in older versions of MySQL (before 5.7.34) are too large. For tables with compact or redundant row formats, index columns should not exceed 767 bytes.

Solution

-- 1. Find indexes that are too large
SELECT table_schema, table_name, index_name,
GROUP_CONCAT(column_name) as columns
FROM information_schema.statistics
WHERE table_schema NOT IN ('mysql', 'information_schema', 'performance_schema', 'sys')
GROUP BY table_schema, table_name, index_name
HAVING SUM(sub_part) > 767 OR (SUM(sub_part) IS NULL AND COUNT(*) > 1);

-- 2. Drop indexes that are too large
ALTER TABLE table_name DROP INDEX index_name;

-- 3. Consider using prefix indexes or changing the row format
ALTER TABLE table_name ROW_FORMAT=DYNAMIC;
ALTER TABLE table_name ADD INDEX index_name (column_name(191));

2.18 Empty Dot Table Syntax Check (mysqlEmptyDotTableSyntaxCheck)

Error message: Check for deprecated '.<table>' syntax used in routines.
Error level: ERROR.

Error Cause

Stored procedures, events, or triggers use the deprecated .<table> syntax (omitting the database name, with only the dot and table name).

Solution

-- Modify the stored procedure to use the full database.table syntax
-- BEFORE MODIFICATION
SELECT * FROM .mytable;

-- AFTER MODIFICATION
SELECT * FROM mydb.mytable;

2.19 Invalid Engine Foreign Key Check (mysqlInvalidEngineForeignKeyCheck)

Error message: Check for columns that have foreign keys pointing to tables from a different database engine
Error level: ERROR.

Error Cause

Foreign keys point to tables using different storage engines. This usually occurs when FOREIGN_KEY_CHECKS=0 is set and caused by incorrect operations.

Solution

-- 1. Find invalid foreign keys
SELECT
fk.TABLE_SCHEMA, fk.TABLE_NAME, fk.CONSTRAINT_NAME,
fk.REFERENCED_TABLE_SCHEMA, fk.REFERENCED_TABLE_NAME,
t1.ENGINE as source_engine, t2.ENGINE as target_engine
FROM information_schema.KEY_COLUMN_USAGE fk
JOIN information_schema.TABLES t1
ON fk.TABLE_SCHEMA = t1.TABLE_SCHEMA AND fk.TABLE_NAME = t1.TABLE_NAME
JOIN information_schema.TABLES t2
ON fk.REFERENCED_TABLE_SCHEMA = t2.TABLE_SCHEMA
AND fk.REFERENCED_TABLE_NAME = t2.TABLE_NAME
WHERE fk.REFERENCED_TABLE_NAME IS NOT NULL
AND t1.ENGINE != t2.ENGINE;

-- 2. Delete invalid foreign keys
ALTER TABLE table_name DROP FOREIGN KEY constraint_name;

-- 3. or recreate the foreign key after unifying the storage engine
ALTER TABLE table_name ENGINE=InnoDB;

3. Storage Engine Check

3.1 Non-native Partitioning Check (nonNativePartitioningCheck)

Error message: Partitioned tables using engines with non native partitioning
Error level: ERROR.

Error Cause

Partitioned tables use storage engines that do not support native partitioning. In MySQL 8.0, only InnoDB and NDB support native partitioning.

Technical Background

Problem
Description
Engines that support native partitioning
InnoDB, NDB/NDBCLUSTER
Engines not supported
MyISAM, ARCHIVE, CSV, and so on
Changes in MySQL 8.0
Removed the generic partitioning handler

Solution

-- 1. Find tables using non-native partitioning
SELECT table_schema, table_name, engine
FROM information_schema.tables
WHERE create_options LIKE '%partitioned%'
AND UPPER(engine) NOT IN ('INNODB', 'NDB', 'NDBCLUSTER');

-- 2. Convert to InnoDB
ALTER TABLE database_name.table_name ENGINE=InnoDB;

-- 3. or remove partitioning
ALTER TABLE database_name.table_name REMOVE PARTITIONING;

3.2 Engine Mixup Check (engineMixupCheck)

Error message: Tables recognized by InnoDB that belong to a different engine
Error level: ERROR.

Error Cause

The table is recognized by the InnoDB engine (with an .ibd file present), but the SQL layer considers it to belong to a different engine (such as MyISAM). This typically occurs when InnoDB table files are manually deleted and a table with the same name is subsequently created using the MyISAM engine.

Solution

-- Complex situations requiring multi-step processing:

-- 1. Rename the current table
RENAME TABLE problem_table TO problem_table_temp;

-- 2. Create a dummy InnoDB table (with the same structure)
CREATE TABLE problem_table (id INT) ENGINE=InnoDB;

-- 3. Drop the dummy table (clean up the InnoDB data dictionary)
DROP TABLE problem_table;

-- 4. Revert the temporary table to its original name
RENAME TABLE problem_table_temp TO problem_table;

4. Tablespace Check

4.1 Cyclic Directory Reference Check (circularDirectoryCheck)

Error message: Circular directory references in tablespace data file paths
Error level: ERROR.

Error Cause

Tablespace data file paths contain circular directory references (such as /../). This type of path has been disallowed since MySQL 8.0.17.

Solution

-- 1. Find tablespaces containing circular references
SELECT FILE_NAME
FROM INFORMATION_SCHEMA.FILES
WHERE FILE_TYPE = 'TABLESPACE'
AND FILE_NAME LIKE '%/../%'

-- 2. Move the data files to a normal path
-- Stop MySQL, manually move the files, then update the data dictionary
-- or Rebuild table
ALTER TABLE table_name ENGINE=InnoDB;

5. System Variables Check

5.1 System Log Variable Check Has Been Removed (removedSysLogVars)

Error message: Removed system variables for error logging to the system log configuration
Error level: ERROR.

Error Cause

Configuration files contain removed system log related variables.

Technical Background

Removed Variables
Alternative Variable
log_syslog_facility
syseventlog.facility
log_syslog_include_pid
syseventlog.include_pid
log_syslog_tag
syseventlog.tag
log_syslog
No direct alternative; use the log_sink_syseventlog component.

Solution

Modify the my.cnf configuration file:
# BEFORE MODIFICATION
[mysqld]
log_syslog=1
log_syslog_facility=daemon
log_syslog_tag=mysql

# AFTER MODIFICATION
[mysqld]
# LOAD SYSTEM LOG COMPONENT
log_error_services='log_filter_internal; log_sink_internal; log_sink_syseventlog'

# USE NEW VARIABLE NAMES
syseventlog.facility=daemon
syseventlog.tag=mysql

5.2 Removed System Variables Check (removedSysVars)

Error message: Removed system variables
Error level: ERROR.

Error Cause

Configuration files contain system variables that have been removed in MySQL 8.0.

Technical Background

Removed variables and their alternatives (partial):
Removed Variables
Alternative Solution
date_format
None.
datetime_format
None.
have_crypt
None.
ignore_builtin_innodb
None.
ignore_db_dirs
None.
innodb_checksums
innodb_checksum_algorithm
innodb_file_format
None (MySQL 8.0 only supports Barracuda)
innodb_file_format_check
None.
innodb_file_format_max
None.
innodb_large_prefix
None (Enabled by default in MySQL 8.0)
innodb_locks_unsafe_for_binlog
None.
innodb_stats_sample_pages
innodb_stats_transient_sample_pages
innodb_support_xa
None (Always enabled in MySQL 8.0)
innodb_undo_logs
innodb_rollback_segments
log_warnings
log_error_verbosity
max_tmp_tables
None.
metadata_locks_cache_size
None.
metadata_locks_hash_instances
None.
old_passwords
None.
query_cache_limit
None (Query cache has been removed)
query_cache_min_res_unit
None.
query_cache_size
None.
query_cache_type
None.
query_cache_wlock_invalidate
None.
secure_auth
None (Always enabled in MySQL 8.0)
sync_frm
None.
tx_isolation
transaction_isolation
tx_read_only
transaction_read_only

Solution

Modify the my.cnf configuration file to remove or replace deprecated variables:
# BEFORE MODIFICATION
[mysqld]
query_cache_size=64M
query_cache_type=1
innodb_file_format=Barracuda
tx_isolation=READ-COMMITTED
log_warnings=2

# AFTER MODIFICATION
[mysqld]
# Remove query_cache related configurations (Query cache has been removed)
# Remove innodb_file_format (8.0 only supports Barracuda)
transaction_isolation=READ-COMMITTED
log_error_verbosity=2

5.3 New Default Values Check for System Variables (sysVarsNewDefaults)

Error message: System variables with new default values
Error level: WARNING.

Error Cause

Certain system variables have new default values in MySQL 8.0. If user applications rely on the old default values, issues may arise.

Technical Background

Important Default Value Changes:
Variable
MySQL 5.7 Default Values
MySQL 8.0 Default Values
Impact
character_set_server
latin1
utf8mb4
Default character set for newly created tables
collation_server
latin1_swedish_ci
utf8mb4_0900_ai_ci
Default collation for newly created tables
explicit_defaults_for_timestamp
OFF
ON
TIMESTAMP column behavior
max_allowed_packet
4MB
64MB
Single data packet size limit
event_scheduler
OFF
ON
Whether the event scheduler is enabled
log_bin
OFF
ON
Whether binary logging is enabled
innodb_autoinc_lock_mode
1
2
Auto-increment lock mode
innodb_flush_neighbors
1
0
Refresh adjacent pages
innodb_max_dirty_pages_pct_lwm
0
10
Dirty pages low watermark
innodb_undo_tablespaces
0
2
Undo tablespace number
innodb_undo_log_truncate
OFF
ON
Whether Undo logs are truncated
back_log
-1
151
Connection queue size
max_error_count
64
1024
Maximum error count
optimizer_trace_max_mem_size
16KB
1MB
Optimizer trace memory

Solution

If relying on old default values, explicitly set in my.cnf:
[mysqld]
# Maintain MySQL 5.7 character set behavior
character_set_server=latin1
collation_server=latin1_swedish_ci

# Maintain MySQL 5.7 TIMESTAMP behavior
explicit_defaults_for_timestamp=OFF

# Maintain MySQL 5.7 auto-increment lock mode (if there is statement-based replication)
innodb_autoinc_lock_mode=1

# If binary logging is not required
skip-log-bin

6. Authentication Plugins Check

6.1 Default Authentication Plugin Check (defaultAuthenticationPlugin)

Error message: New default authentication plugin considerations
Error level: WARNING (manual check required).

Error Cause

The default authentication plugin for MySQL 8.0 has changed from mysql_native_password to caching_sha2_password, which may cause connection issues for older clients.

Technical Background

Problem
Description
New default plugin
caching_sha2_password
Old default plugin
mysql_native_password
Security
caching_sha2_password provides stronger password hashing.
Compatibility
Old clients/drivers may not support the new plugin.

Solution

Option 1: Upgrade the client driver to a version that supports caching_sha2_password.
Option 2: Temporarily use the old authentication plugin.
# my.cnf
[mysqld]
default_authentication_plugin=mysql_native_password
Option 3: Use the old plugin for specific users.
-- Create a user using the old plugin
CREATE USER 'user'@'host' IDENTIFIED WITH mysql_native_password BY 'password';

-- Or modify existing users
ALTER USER 'user'@'host' IDENTIFIED WITH mysql_native_password BY 'password';

7. Problem Level Description

Level
Description
Processing Requirements
ERROR
Critical issues must be resolved before upgrading.
Upgrade may fail or cause data unavailability.
WARNING
Potential issues; it is recommended to resolve them.
Features or performance may be affected post-upgrade.
NOTICE
Prompt message
The upgrade is not affected, but it is worth noting.

Appendix: Quick Check Script

-- Comprehensive pre-upgrade check script
-- Run this script to quickly detect most upgrade issues.

-- 1. Check old time formats
SELECT 'Old time format' as check_type, table_schema, table_name, column_name
FROM information_schema.columns
WHERE column_type LIKE '%5.5 binary format%'
and table_schema not in ('information_schema','mysql','performance_schema','sys');

-- 2. Check the utf8mb3 character set
SELECT 'UTF8MB3 character set' as check_type, table_schema, table_name, column_name
FROM information_schema.columns
WHERE character_set_name IN ('utf8', 'utf8mb3') and table_schema not in ('information_schema','mysql','performance_schema','sys')
LIMIT 20;

-- 3. Check zero date default values
SELECT 'Zero date default values' as check_type, table_schema, table_name, column_name
FROM information_schema.columns
WHERE column_default LIKE '0000-00-00%' and table_schema not in ('information_schema','mysql','performance_schema','sys')
LIMIT 20;

-- 4. Check non-InnoDB partitioned tables
SELECT 'Non-native partitioning' as check_type, table_schema, table_name, engine
FROM information_schema.tables
WHERE create_options LIKE '%partitioned%'
AND UPPER(engine) NOT IN ('INNODB', 'NDB', 'NDBCLUSTER') and table_schema not in ('information_schema','mysql','performance_schema','sys');

-- 5. Check the length of foreign key constraint names
SELECT 'Foreign key name too long' as check_type,
SUBSTRING_INDEX(id, '/', 1) as db_name,
SUBSTRING_INDEX(id, '/', -1) as table_name,
LENGTH(SUBSTRING_INDEX(id, '/', -1)) as name_length
FROM information_schema.innodb_sys_foreign
WHERE LENGTH(SUBSTRING_INDEX(id, '/', -1)) > 64;

-- 6. Check which tables have undergone Instant DDL
SELECT b.name from information_schema.INNODB_SYS_INSTANT_COLS a join information_schema.INNODB_SYS_TABLES b on a.table_id=b.table_id;

-- 7. Check which tables have undergone modify column
SELECT b.name from information_schema.INNODB_SYS_INSTANT_MODIFIED_COLS a join information_schema.INNODB_SYS_TABLES b on a.table_id=b.table_id;

-- 8. Check orphaned stored procedures
SELECT 'Orphaned stored procedures' as check_type, ROUTINE_SCHEMA, ROUTINE_NAME
FROM information_schema.routines
WHERE NOT EXISTS (
SELECT SCHEMA_NAME
FROM information_schema.schemata
WHERE ROUTINE_SCHEMA = SCHEMA_NAME
);

References

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback