Help Center/ Data Replication Service/ Troubleshooting/ Solutions to Failed Check Items/ Database Parameters/ Checking Whether the innodb_strict_mode Values of the Source and Destination Databases Are the Same
Updated on 2024-06-07 GMT+08:00

Checking Whether the innodb_strict_mode Values of the Source and Destination Databases Are the Same

Check whether the innodb_strict_mode values of the source and destination databases are the same. If they are different, the task may fail. You are advised to change them to the same value.

The database parameter innodb_strict_mode specifies whether to enable the strict check mode. If innodb_strict_mode is set to ON, InnoDB returns errors rather than warnings when checking for invalid CREATE TABLE, ALTER TABLE, or CREATE INDEX statement. If innodb_strict_mode is set to OFF, InnoDB uses the default syntax when checking for invalid syntax. For example, in MySQL 5.7.34, if innodb_strict_mode is set to ON and the table creation statement CREATE TABLE t1(c1 int, c2 varchar(32)) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED is executed, the error Table storage engine for 't1' doesn't have this option is reported.

In a DRS task, if innodb_strict_mode of the source database is set to OFF and innodb_strict_mode of the destination database is set to ON, no error will be reported when DDL statements are executed in the source database due to syntax errors, and an error will reported data is synchronized to the destination database. As a result, the task fails.

Failure Cause

The innodb_strict_mode values of the source and destination databases must be the same.

Handling Suggestion

Change the value of innodb_strict_mode of the source database to be the same as that of the destination database.
  • If the database is a self-managed MySQL database, run commands to change the value.
    1. Run the following command to check the value:
      SHOW VARIABLES LIKE "innodb_strict_mode";
    2. Run the following command to change the value:
      SET GLOBAL innodb_strict_mode = <value>;

      To disable this option, set <value> to 0. To enable this option, set <value> to 1.

  • If the database is an RDS for MySQL DB instance, change the value of the innodb_strict_mode parameter by referring to Modifying Parameters of an RDS for MySQL Instance.

For details about how to change the value of innodb_strict_mode for other types of databases, see the usage guide of the corresponding database.