Data Transfer from TiDB to MySQL Results in Primary Key Conflict

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

Original topic: 从TiDB->MySQL导数据,出现主键冲突

| username: TiDBer_idvN8NKU

[TiDB Usage Environment] Testing

Using the import and export data function of a database client tool (such as DBeaver) to import table data from TiDB to MySQL, with identical table structures and primary keys on both sides, there are always primary key conflicts when importing data in batches from TiDB to MySQL. Conversely, there are no primary key conflicts when importing data in batches from MySQL to TiDB. What is the reason for this? How can it be resolved?

| username: tidb菜鸟一只 | Original post link

Could you share the table structures from both sides?

| username: Kongdom | Original post link

It can’t be an auto-increment primary key, right?

| username: TiDB_C罗 | Original post link

Take a screenshot.

| username: zhanggame1 | Original post link

Conflicts usually indicate which key is involved, check to see why.

| username: TiDBer_idvN8NKU | Original post link

This issue only occurs when importing data from TiDB to MySQL, regardless of whether the table has a TiFlash replica or whether the table’s primary key is a single primary key or a composite primary key. Conversely, importing data from MySQL to TiDB does not result in primary key conflicts.