Help Center/ Data Replication Service/ Troubleshooting/ Solutions to Failed Check Items/ Database Parameters/ Checking Whether the Source and Destination Database Character Sets Are Consistent
Updated on 2024-09-25 GMT+08:00

Checking Whether the Source and Destination Database Character Sets Are Consistent

Check whether the source and destination database character sets are consistent. If the character set of the source database is different from that of the destination database, some data may be garbled or inconsistent.

Failure Cause

The character sets of the source and destination databases are inconsistent.

Handling Suggestion

Change the character set of the source or destination database.

  • If a MySQL database is used, perform the following operations:
    • If the database is a self-managed database, run commands to change the character set.
      1. Run the following command to check the character set of the database:
        SHOW VARIABLES LIKE "character_set_server"\G;

      2. Modify the character set of the source database server.
        SET character_set_server='utf8';

    • If the database is an RDS for MySQL DB instance, modify the character_set_server parameter..
  • If a PostgreSQL database is used, perform the following operations:
    • If the database is a self-managed database, run commands to change the character set.
      1. Run the following command to check the character set of the database:
        show server_encoding;
      2. Modify the character set of the source database server.
        set server_encoding='utf8';
    • If the database is an RDS for PostgreSQL DB instance, modify the server_encoding parameter..

    For details about how to modify character set parameters for other types of databases, see the usage guide of the corresponding database.