Migrating MySQL Data to TiDB

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

Original topic: 把mysql数据迁移到tidb

| username: 我在路上

Besides using TiDB’s tool TiUP Lightning, are there any other methods to migrate MySQL data to TiDB? My Lightning keeps throwing errors, and when I use mysqldump for migration, it gets interrupted midway through the data transfer. The error seems to be due to keyword conflicts. Are there any other methods?

| username: xiaohetao | Original post link

DM (TiDB Data Migration)

| username: xiaohetao | Original post link

I think the problem might be related to the configuration of the max_allowed_packet parameter in MySQL. You can try increasing the value of this parameter in the MySQL configuration file and then restart the MySQL service.

| username: xiaohetao | Original post link

| username: forever | Original post link

Did you handle the data and table structure together, or did you migrate the table structure first and then the data?

| username: gary | Original post link

Use the DM tool for full data migration.

| username: hey-hoho | Original post link

If your data volume is small and you need a one-time migration, use the simplest method:

  1. Use mysqldump to export the SQL file.
  2. Use the MySQL client to load the SQL file into TiDB.

For large data volumes, it is recommended to use Dumpling + Lightning (for one-time full migration).
For incremental synchronization, it is recommended to use DM.

| username: alfred | Original post link

A better solution

| username: 我在路上 | Original post link

Migrate together

| username: forever | Original post link

It is recommended to do it separately. First, migrate the table structure, which can also be used to verify any issues with the table structure. Any problematic structures can be adjusted, and then proceed with the data migration.

| username: buchuitoudegou | Original post link

Could you elaborate on this? DM also calls lightning, so if you encounter an error here, it might also occur with DM.

| username: xiaohetao | Original post link

Separating tasks can relatively reduce or minimize errors.

| username: xiaohetao | Original post link

If it’s a small amount of data, you can export it as SQL statements. Importing is also very fast, convenient, and simple.

| username: xiaohetao | Original post link

If the database volume is large, use Dumpling and Lightning.

| username: HACK | Original post link

Your import has an issue that needs to be resolved first. Even if you use other tools for data synchronization, you still need to import the data to the target end first.
What specific error is being reported?

| username: 张雨齐0720 | Original post link

There has been a lot of discussion about online migration.
For offline migration, you can try DataX.

| username: wuxiangdong | Original post link

For small databases, you can use mysqldump + source.

| username: forever | Original post link

If it’s a few million, then Navicat can handle it.

| username: system | Original post link

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