×
Community Blog Best Practices for Upgrading PolarDB for MySQL 5.7/MySQL 5.7 to PolarDB for MySQL 8.0

Best Practices for Upgrading PolarDB for MySQL 5.7/MySQL 5.7 to PolarDB for MySQL 8.0

This article describes the common issues encountered during the upgrade from PolarDB for MySQL 5.7/MySQL 5.7 to PolarDB for MySQL 8.0.

By Daoke

1. Upgrade Overview

During the upgrade from PolarDB for MySQL 5.7/MySQL 5.7 to PolarDB for MySQL 8.0, common issues arise with performance, syntax compatibility, and peripheral component support. Performance problems in queries are usually caused by changes in the execution plan due to optimizer upgrades. However, such issues can be resolved through targeted performance optimization and do not require code rewriting or cause business errors. Therefore, this article will not discuss such issues.

This article focuses on real compatibility problems that require code updates or changes in the environment configuration during the database upgrade process. The main causes of compatibility problems are syntax changes, feature updates, and removals in newer versions.

2. Configuration Compatibility

2.1 Engine and Partition Table Compatibility

In PolarDB for MySQL 8.0, creating a partition of MyISAM type will cause a storage engine partition table that does not support this type to fail to create statements and report an error (ER_CHECK_NOT_IMPLEMENTED). For information about converting MyISAM tables to InnoDB, see Converting Tables from MyISAM to InnoDB.

The PolarDB for MySQL storage engines now provide their own partition handlers, and PolarDB for MySQL servers no longer provide general-purpose engine partition support. InnoDB is the only storage engine that provides native partition handlers supported by PolarDB for MySQL 8.0. Before upgrading the server, you need to convert the partition tables of non-InnoDB storage engine to the partition tables of InnoDB storage engine, or delete the partition tables and convert them to regular tables. Otherwise, it cannot be used later. If there are similar partitions, you need to convert the engine in advance before upgrading. Check the engine syntax as follows:

SELECT TABLE_SCHEMA, TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES 
WHERE ENGINE NOT IN ('innodb', 'ndbcluster') AND CREATE_OPTIONS LIKE '%partitioned%';
Or
SELECT DISTINCT NAME, SPACE, SPACE_TYPE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE NAME LIKE '%#P#%' AND SPACE_TYPE NOT LIKE 'Single';

Convert to an InnoDB engine or delete the partition:

<mysql> ALTER TABLE part ENGINE = INNODB;
Query OK, 0 rows affected (0.09 sec)
 
OR
 
<mysql> ALTER TABLE part REMOVE PARTITIONING;
Query OK, 0 rows affected (0.06 sec)

If you use a MySQLdump to import a database into a PolarDB for MySQL 8.0 server from a dump file created in MySQL 5.7 (or earlier), you must ensure that any statement that creates a partition table does not specify an unsupported storage engine. In doing so, you need to remove any references to the partition, specify the storage engine as InnoDB, or allow the engine to be set as the default value of InnoDB. The procedures in "Prepare Installation for Upgrade" describe how to identify partition tables that must be changed before upgrading to MySQL 8.0. For more information, see Storage Engine-Related Partition Restrictions.

2.2 Character Set & Collation Compatibility

In MySQL 8.0, the default field set is changed to utf8mb4. Both ApsaraDB RDS for MySQL and PolarDB for MySQL 8.0 have the default character_set_server value set to utf8 for compatibility purposes. However, you can adjust it based on your business requirements. To improve Unicode support, it is recommended to convert the utf8mb3 character set to utf8mb4. The use of utf8mb3 is not recommended. It is also recommended to use utf8mb4 instead of utf8, as utf8 is an alias for utf8mb3. For more information, refer to the MySQL documentation on utf8mb3 Character Set (3-byte UTF-8 unicode encoding).

MySQL 8.0 introduces the default_collation_for_utf8mb4 parameter, used for sorting with the default collation when the character set is utf8mb4. The default value is utf8mb4_0900_ai_ci. According to the official documentation, this parameter is only used internally by MySQL Replication. Therefore, it is advised not to change the default value to utf8mb4_general_ci/utf8_general_ci unless you encounter "Illegal mix of collations" errors during synchronization from a lower version to a higher version.

utf8mb4_unicode_ci is used for general sorting and comparison based on official Unicode rules. It offers high accuracy, but the comparison speed is slightly slower.

utf8mb4_general_ci is a collation that simplifies sets. Its purpose is to provide a simplified design to speed up. Although it does not follow the Unicode rules, the results are in line with expectations in the same situation.

Sorting rules are different from character sets. They are related to sorting and comparison, where ai refers to accent insensitivity. In other words, there is no difference between e,è,é,ê and ë when sorting, and ci means case insensitivity. That is, there is no difference between p and P during sorting.

Usage note

  • For example, the script may not be supported when reverse synchronization or dump synchronization is performed from MySQL 8.0 to earlier versions.
  • This is easy to occur in two-way synchronization between earlier and later versions of DTS. You must use the default sorting character sets of MySQL 5.7. Otherwise, exceptions may occur when DTS performs reverse synchronization.
  • The Illegal mix of collations errors may be reported due to collation problems when you create a view, such as using convert(a.c1 using utf8mb4) = b.c1.
  • The reason is that if you use convert(exp using utf8mb4) and do not specify collation, MySQL will query according to utf8mb4. At this time, the returned charset number is always 255, and the collation corresponding to 255 is the default utf8mb4_0900_ai_ci of MySQL 8.0.
  • Modifying the default_collation_for_utf8mb4, or specifying the collations of column, table, and db in DDL will not work. If you need to use the convert function, you can add collation to the statement, such as (convert (a.c1 using utf8mb4) collate utf8mb4_general_ci) = b.c1.
  • If you change the default value of default_collation_for_utf8mb4, such as changing it to utf8mb4_unicode_ci, the SYS library cannot be read, and its related functions cannot be read. In this case, the error "Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_0900_ai_ci,IMPLICIT) for operation '='" is reported. In addition, it will cause the upgrade from PolarDB 8.0.1 to PolarDB 8.0.2 to fail. This parameter is newly added in PolarDB 8.0, so it is recommended not to modify this parameter. If you must use other values, apply to reset the default value of the parameter to utf8mb4_0900_ai_ci before upgrading. After the upgrade is finished, modify it to the original value.

2.3 Parameter Compatibility

lower_case_table_names

Starting with MySQL 8.0.11, lower_case_table_names are prohibited from starting the server with settings different from those used when the server was initialized. This restriction is necessary because the collation used by various data dictionaries and table fields is based on the settings defined when the lower_case_table_names server is initialized. When the server is restarted with different settings, inconsistencies in how identifiers are sorted and compared will be introduced. In PolarDB for MySQL 8.0, the instance case sensitivity cannot be changed again after initialization. You must select whether to choose case sensitivity when you purchase a PolarDB for MySQL 8.0 instance.

sql_mode

To avoid startup failures of PolarDB for MySQL 8.0, remove all instances from the system variable sql_mode setting in the MySQL options file via NO_AUTO_CREATE_USER. Obsolete SQL modes must not be defined in your system variable settings. Otherwise, sql_mode will cause many different behaviors. Alignment must be confirmed during version upgrade. Cancel the following configuration items:

DB2, MAXDB, MSSQL, MYSQL323, MYSQL40, ORACLE, POSTGRESQL, NO_FIELD_OPTIONS , NO_KEY_OPTIONS, NO_TABLE_OPTIONS

Most of the above configuration items are combined configurations. Pay attention to whether there are inconsistent mode options. For example, sql_mode=TRADITIONAL equals configuring the following items:

STRICT_TRANS_TABLES, STRICT_ALL_TABLES, NO_ZERO_IN_DATE, NO_ZERO_DATE, ERROR_FOR_DIVISION_BY_ZERO, NO_ENGINE_SUBSTITUTION. 

In the default configurations of MySQL 5.7, the sql_mode=TRADITIONAL equals to configure the following items:

STRICT_TRANS_TABLES, STRICT_ALL_TABLES, NO_ZERO_IN_DATE, NO_ZERO_DATE,
ERROR_FOR_DIVISION_BY_ZERO, NO_AUTO_CREATE_USER, and NO_ENGINE_SUBSTITUTION.

Compared with the above configuration items, we can see that the NO_AUTO_CREATE_USER option is added in MySQL 5.7. However, MySQL 8.0 has prohibited the implicit creation of accounts using GRANT statements. Although the NO_AUTO_CREATE_USER option is added in MySQL 5.7, GRANT can also be used to create accounts when the identified by is specified.

3. View/Table and Keyword

3.1 InnoDB-related Views

INFORMATION_SCHEMA views based on InnoDB system tables are replaced by internal system views of data dictionary tables. The affected InnoDB INFORMATION_SCHEMA view has been renamed. When directly accessing InnoDB-related views in the system application, it is necessary to confirm whether they have been modified in the application.

Renamed InnoDB Information Mode View

Old Name New name
INNODB_SYS_COLUMNS INNODB_COLUMNS/td>
INNODB_SYS_DATAFILES INNODB_DATAFILES
INNODB_SYS_FIELDS INNODB_FIELDS
INNODB_SYS_FOREIGN INNODB_FOREIGN
INNODB_SYS_FOREIGN_COLS INNODB_FOREIGN_COLS
INNODB_SYS_INDEXES INNODB_INDEXES
INNODB_SYS_TABLES INNODB_TABLES
INNODB_SYS_TABLESPACES INNODB_TABLESPACES
INNODB_SYS_TABLESTATS INNODB_TABLESTATS
INNODB_SYS_VIRTUAL INNODB_VIRTUAL

In the 5.7 version, a view with the same name added in the 8.0 cannot exist. Execute the following statement in the 5.7 instance. If there is a response, you need to confirm how to process such a table. In theory, RDS on the cloud does not have the permission to directly operate the MySQL database. This check is recommended when the user-created instance is upgraded to the cloud.

SELECT TABLE_SCHEMA, TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE LOWER(TABLE_SCHEMA) = 'mysql'
and LOWER(TABLE_NAME) IN
(
'catalogs',
'character_sets',
'check_constraints',
'collations',
'column_statistics',
'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',
'resource_groups',
'routines',
'schemata',
'st_spatial_reference_systems',
'table_partition_values',
'table_partitions',
'table_stats',
'tables',
'tablespace_files',
'tablespaces',
'triggers',
'view_routine_usage',
'view_table_usage'
);

Suppose
+--------------+------------+
| TABLE_SCHEMA | TABLE_NAME |
+--------------+------------+
| mysql        | catalogs   |
+--------------+------------+
1 row in set (0.00 sec)

3.2 View Compatibility

Before MySQL 8.0, you can create views with explicit column names of up to 255 characters. In order not to exceed the maximum length of column names, MySQL 8.0 does not support views with explicit column names longer than 64 characters. At present, these views can only be identified by executing SHOW CREATE VIEW in MySQL 5.7.

mysql> SHOW CREATE VIEW v1;
+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
| View | Create View                                                                                                                                                                  | character_set_client | collation_connection |
+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
| v1   | CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `a123456789012345678901234567890123456789012345678901234567890123456789` | utf8                 | utf8_general_ci      |
+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
1 row in set (0.00 sec

Modify the view names before upgrading to PolarDB for MySQL 8.0.

mysql> ALTER VIEW v1(a12345678901234567890) AS SELECT 1;

4. Type Compatibility

4.1 Enumeration and Set Type Compatibility

The length of a single ENUM or SET column element of a table or stored procedure must not exceed 255 characters or 1020 bytes.

4.2 Changes to INT Data in the JSON Type

Individual INT type in JSON has been added .0 to become similar to 1.0 or 9999.0. It is initially confirmed that MySQL 5.7 and PolarDB for MySQL 8.0 have different processing methods for double precision in JSON. To solve this problem, DTS data verification is required to check whether the frontend has handled this problem.

4.3 MySQL 5.x Legacy Type Compatibility

Data types such as legacy decimal, legacy varchar, and legacy TIME/DATETIME and TIMESTAMP are obsolete in MySQL 5.1, MySQL 5.0, and MySQL 5.6, respectively. This is because binary upgrades will not be supported in MySQL 8.0 as they are only available in MySQL 5.7. These tables can be identified by running CHECK TABLE…FOR UPGRADE or mysqlcheck with the check-upgrade option in the MySQL 5.7 before the upgrade. In addition, tables that use the legacy TIME/DATETIME and TIMESTAMP can be identified by enabling session variables. For more information, see How to Easily Identify Tables With Temporal Types in Old Format!

mysql> check table 41_decimal for upgrade;
+-----------------+-------+----------+-------------------------------------------------------------------------------------+
| Table           | Op    | Msg_type | Msg_text                                                                            |
+-----------------+-------+----------+-------------------------------------------------------------------------------------+
| test.41_decimal | check | error    | Table upgrade required for `test`.`41_decimal`. Please dump/reload table to fix it! |
+-----------------+-------+----------+-------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
 
mysql> check table 55_temporal for upgrade;
+------------------+-------+----------+------------------------------------------------------------------------------------------+
| Table            | Op    | Msg_type | Msg_text                                                                                 |
+------------------+-------+----------+------------------------------------------------------------------------------------------+
| test.55_temporal | check | error    | Table upgrade required. Please do "REPAIR TABLE `55_temporal`" or dump/reload to fix it! |
+------------------+-------+----------+------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
 
nisha@nisha-PORTEGE-Z30-A:~/workspace1/mysql-5.7/dbg-5.7/client/mysqlcheck --user=root --socket=/home/nisha/workspace1/mysql-5.7/dbg-5.7/data/mysql.sock --databases test --check-upgrade
error    : Table upgrade required for `test`.`41_decimal`. Please dump/reload table to fix it!
test.55_temporal
error    : Table upgrade required. Please do "REPAIR TABLE `55_temporal`" or dump/reload to fix it!
test.child                                         OK
test.geom                                          OK
test.jemp                                          OK
test.jemp_myisam                                   OK
test.opening_lines                                 OK
test.parent                                        OK
test.t_blackhole                                   OK
test.t_blob                                        OK
test.t_blob_myisam                                 OK
test.t_compressed                                  OK
test.t_compressed2                                 OK
test.t_compressed3                                 OK
test.t_dynamic                                     OK
test.t_gen_stored                                  OK
test.t_gen_stored_myisam                           OK
test.t_gen_stored_myisam2                          OK
test.t_index                                       OK
test.t_json                                        OK
test.t_myisam_compressed                           OK
test.t_myisam_compressed2                          OK
test.t_myisam_compressed3                          OK
test.t_sc~!@#$%^&*(                                OK
test.vt2                                           OK

Tables that use such data types cannot be upgraded and should be fixed via REPAIR TABLE and dumped or reloaded for legacy varchar or legacy decimal:

mysql> REPAIR TABLE 55_temporal;
 
+------------------+--------+----------+-------------------------------------------------------------------------------------+
| Table            | Op     | Msg_type | Msg_text                                                                            |
+------------------+--------+----------+-------------------------------------------------------------------------------------+
| test.55_temporal | repair | Note     | TIME/TIMESTAMP/DATETIME columns of old format have been upgraded to the new format. |
| test.55_temporal | repair | status   | OK                                                                                  |
+------------------+--------+----------+-------------------------------------------------------------------------------------+
2 rows in set (0.01 sec)
 
mysql> 
 
Dump: 
$./client/mysqldump --databases test --socket=5.7/data/mysql.sock --user=root>test.sql
 
Restore:
mysql> .\ test.sql 

5. Keyword and Reserved Words

PolarDB for MySQL 8.0 can view the keywords and reserved words of the current version through the information_schema. KEYWORDS table to ensure that there are no illegal keywords and reserved words. Some previously unreserved keywords may be reserved in the PolarDB for MySQL 8.0. For more information, see Keywords and Reserved Words in the MySQL documentation. We recommend that you avoid using all custom content (table names, field names, and function names). KICKOUT is a reserved keyword of PolarDB for MySQL 8.0. Therefore, if you have used this keyword as an object name (such as a table name, a field name, or a stored procedure name) in MySQL 5.7 or open source MySQL 8.0, you must modify the object name to avoid using this keyword before you upgrade to PolarDB for MySQL 8.0. Otherwise, the error code 1064 that indicates a syntax error is returned.

Supplementary keywords (RDS)

Some businesses will use the self-built serial number generator functions nextval and currval. These two keywords are reserved words in RDS for MySQL 8.0. You need to change the function names or directly use the seq function provided by RDS.

CREATE sequence s START WITH 1 minvalue 1 MAXVALUE 9999999 increment BY 1 CACHE 20 cycle;
SELECT nextval(s),currval(s);

6. SQL compatibility

6.1GRANT Authorization

In MySQL 8.0.11, several obsolete features related to account management, such as using GRANT statements to modify non-privileged features of user accounts, have been removed. Example:

GRANT REPLICATION CLIENT ON *.* TO 'odps'@'%'; You are not allowed to create a user with GRANT needs to be created by two steps
create user;
grant privielges;

6.2 GROUP BY ASC and DESC Are not Supported.

Starting with MySQL 8.0.13, the obsolete clause ASC or the DESC qualifier GROUP BY has been removed. The queries that relied on GROUP BY sorting might produce different results compared with those of previous MySQL versions. To generate a given sort order, you need to provide an ORDER BY clause.

select id,count(*) from sbtest.sbtest1 where id < 10 group by id desc

The SQL statement needs to be rewritten as:

select id,count(*) from sbtest.sbtest1 where id < 10 group by id order by id

6.3 Definition of Foreign Key Constraint

In MySQL 5.7, InnoDB that defines FOREIGN KEY must not have the keyword CONSTRAINT and specify that the foreign key constraint name must not exceed 64 characters. In versions earlier than MySQL 8.0, when you did not explicitly specify the foreign key constraint name, InnoDB would automatically generate the foreign key constraint name by appending '_ibfk_X' to the table name, where X is a number. If the table name is multi-byte 64 characters, such as the Cyrillic table name имя_базы_в_кодировке_утф8_длиной_больше_чем_45имя_азы_в_кодировк used in the following example, the automatically generated foreign key constraint name exceeds 64 characters. You should change these tables by removing the constraint and adding a constraint with an explicit constraint name by ensuring that the foreign key constraint name does not exceed 64 characters.

mysql> ALTER TABLE `имя_базы_в_кодировке_утф8_длиной_больше_чем_45имя_азы_в_кодировк` DROP FOREIGN KEY `имя_базы_в_кодировке_утф8_длиной_больше_чем_45имя_азы_в_кодировк_ibfk_1`;
Query OK, 0 rows affected (0.01 sec)
Records: 0  Duplicates: 0  Warnings: 0
 
mysql> ALTER TABLE `имя_базы_в_кодировке_утф8_длиной_больше_чем_45имя_азы_в_кодировк` ADD CONSTRAINT FOREIGN KEY FK1 (fld2) REFERENCES t1(fld1);
Query OK, 0 rows affected (0.13 sec)
Records: 0  Duplicates: 0  Warnings: 0

6.4 Spatial Function

In MySQL 5.7, it is not recommended to use spatial functions that are available under multiple names. Example: PointFromText

mysql> CREATE TABLE t_gcol_dep (fid INTEGER NOT NULL PRIMARY KEY, g POINT GENERATED ALWAYS AS (PointFromText(POINT(10, 10))));
Query OK, 0 rows affected, 1 warning (0.07 sec)
 
mysql> CREATE TABLE t_gcol_dep (fid INTEGER NOT NULL PRIMARY KEY, g POINT GENERATED ALWAYS AS (PointFromText(POINT(10, 10))));
Query OK, 0 rows affected, 1 warning (0.07 sec)
 
mysql> show warnings;
+---------+------+------------------------------------------------------------------------------------------------------------+
| Level   | Code | Message                                                                                                    |
+---------+------+------------------------------------------------------------------------------------------------------------+
| Warning | 1287 | 'POINTFROMTEXT' is deprecated and will be removed in a future release. Please use ST_POINTFROMTEXT instead |
+---------+------+------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

These space functions were deleted in MySQL 8.0 due to the change to spatial function names. This change helps keep the naming convention consistent, that is, the function starts with "ST_" (if it performs an exact operation), or starts with "MBR" (if it performs an operation based on the minimum bounding rectangle). Columns generated by using such functions should be changed before the upgrade. A list of deleted spatial functions can be found in the following documents. You must change the generated columns to use the appropriate ST_or MBR function.

mysql> ALTER TABLE t_gcol_dep MODIFY g POINT GENERATED ALWAYS AS (ST_POINTFROMTEXT(POINT(10, 10)));
Query OK, 0 rows affected (0.03 sec)
Records: 0  Duplicates: 0  Warnings: 0

6.5 Trigger Compatibility

CREATE TRIGGER earlier than MySQL 5.0.17 does not support the definer attribute. Such trigger definitions with missing or empty definer attributes or invalid creation contexts (i.e. character_set_client, collation_collection, database collation attributes) persist, causing MySQL 5.7 to fail to upgrade. These triggers can be identified by running mysqlcheck or CHECK TABLE with the option to check for upgrades in MySQL 5.7.

$./client/mysqlcheck --user=root --socket=5.7/data/mysql.sock --databases triggers --check-upgrade 
triggers.t1
Warning  : No definer attribute for trigger 'triggers'.'trg_t1_before_insert'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger.
Warning  : No definer attribute for trigger 'triggers'.'t1_bi'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger.
Warning  : No definer attribute for trigger 'triggers'.'trg_t1_after_insert_1'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger.
Warning  : No definer attribute for trigger 'triggers'.'trg_t1_after_insert'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger.
Warning  : No definer attribute for trigger 'triggers'.'trg_t1_after_insert_3'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger.
Warning  : No definer attribute for trigger 'triggers'.'trg_t1_before_update_3'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger.
Warning  : No definer attribute for trigger 'triggers'.'trg_t1_before_update'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger.
Warning  : No definer attribute for trigger 'triggers'.'trg_t1_after_update'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger.
Warning  : No definer attribute for trigger 'triggers'.'trg1'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger.
status   : OK
triggers.t2                                        OK

 
mysql> check table t1;
+-------------+-------+----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table       | Op    | Msg_type | Msg_text                                                                                                                                                                                                         |
+-------------+-------+----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| triggers.t1 | check | Warning  | No definer attribute for trigger 'triggers'.'trg_t1_before_insert'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger.   |
| triggers.t1 | check | Warning  | No definer attribute for trigger 'triggers'.'t1_bi'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger.                  |
| triggers.t1 | check | Warning  | No definer attribute for trigger 'triggers'.'trg_t1_after_insert_1'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger.  |
| triggers.t1 | check | Warning  | No definer attribute for trigger 'triggers'.'trg_t1_after_insert'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger.    |
| triggers.t1 | check | Warning  | No definer attribute for trigger 'triggers'.'trg_t1_after_insert_3'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger.  |
| triggers.t1 | check | Warning  | No definer attribute for trigger 'triggers'.'trg_t1_before_update_3'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger. |
| triggers.t1 | check | Warning  | No definer attribute for trigger 'triggers'.'trg_t1_before_update'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger.   |
| triggers.t1 | check | Warning  | No definer attribute for trigger 'triggers'.'trg_t1_after_update'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger.    |
| triggers.t1 | check | Warning  | No definer attribute for trigger 'triggers'.'trg1'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger.                   |
| triggers.t1 | check | status   | OK                                                                                                                                                                                                               |
+-------------+-------+----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
10 rows in set (0.01 sec)
 
 
mysql> select definer, trigger_name from INFORMATION_SCHEMA.TRIGGERS where definer='';
+---------+------------------------+
| definer | trigger_name           |
+---------+------------------------+
|         | trg_t1_before_insert   |
|         | t1_bi                  |
|         | trg_t1_after_insert_1  |
|         | trg_t1_after_insert    |
|         | trg_t1_after_insert_3  |
|         | trg_t1_before_update_3 |
|         | trg_t1_before_update   |
|         | trg_t1_after_update    |
|         | trg1                   | 
+---------+------------------------+
 9 rows in set (0.02 sec)
mysql>

Such triggers should be dumped or reloaded to resolve the following problems:

Dump:
$./client/mysqldump --databases triggers --socket=5.7/data/mysql.sock --user=root>triggers.sql
 
Restore:
mysql> .\ triggers.sql

6.6 Sorting Problems Caused by Parallel Queries

PolarDB for MySQL 8.0 supports parallel queries. Parallel scanning causes MySQL's default serial scanning order to change randomly each time due to random data access, especially when paged SQL is involved. If you need to create a given sorting order, provide an ORDER BY clause to ensure the order.

7. Other

7.1 Client Compatibility

For Java applications, MySQL Connector/J is recommended to be upgraded to version 8.0.8 and above. Version 8.0.8 and above can connect to MySQL 8.0 server, but caching_sha2_password is used. (Connector/J 8.0.9 or higher caching_sha2_password is required for connection accounts.).

If dataworks is not set to utf8 in the data source, an error may occur. It is recommended to change the database name to be consistent with RDS. Add the following connection string to PolarDB for MySQL: characterEncoding=utf8&com.mysql.jdbc.faultInjection.serverCharsetIndex=

7.2Unknown system variable 'tx_read_only'

The tx_read_only Environment Changes Have Been Deleted in PolarDB for MySQL 8.0 and Need to Be Replaced by transaction_read_only.

select @@tx_read_only

Need to be changed to:

select @@transaction_read_only

7.3 Upgrade Checker

The official website provides the version 8.0 upgrade checker, which is not supported by PolarDB for MySQL. For more information about upgrading self-built databases, see Checker.

8. Reference

0 1 0
Share on

Morningking

7 posts | 0 followers

You may also like

Comments

Morningking

7 posts | 0 followers

Related Products