TiDB Encoding Issues

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: tidb编码问题

| username: TiDBer_4RX8Mmfq

Illegal mix of collations (utf8mb4_0900_ai_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for operation ‘=’
MyBatis reports an encoding error when executing the query SQL, but executing the same SQL in Navicat does not report an error. After checking, all encodings are utf8mb4_general_ci, and utf8mb4_0900_ai_ci was not found. What causes this and how should it be resolved?

| username: WalterWj | Original post link

Is it possible that the collation configuration in mybatis is incorrect? Something like jdbc:mysql://host:port/database?useUnicode=yes&characterEncoding=UTF-8?

| username: TiDBer_RjzUpGDL | Original post link

Please share the SQL and table structure.

| username: vincentLi | Original post link

It should be caused by different client versions. The default character set for MySQL 8.0 drivers is utf8mb4_0900_ai_ci. I guess you are using the 5.7 driver for Navicat.

| username: TiDBer_4RX8Mmfq | Original post link

Yes :+1:

| username: Kongdom | Original post link

:+1: :+1: :+1: It is clear that you have had similar experiences.

| username: dba远航 | Original post link

Version issue

| username: DBAER | Original post link

Compare the driver client versions.

| username: 不想干活 | Original post link

What you said is very reliable.

| username: zhang_2023 | Original post link

:+1:

| username: TiDBer_LM | Original post link

This is impressive, very experienced.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.