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: 每天当牛马

How can I quickly migrate 210,000 tables from MySQL to TiDB?

| username: ShawnYan | Original post link

Depending on the total data size, you can use mysqldump to export and then load the data into TiDB.

| username: 每天当牛马 | Original post link

Can mysqldump export so many tables? It didn’t seem to work before. Are there any parameters that need to be adjusted?

| username: 每天当牛马 | Original post link

Moreover, mysqldump takes quite a long time. Is there a faster method?

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

Considering the total amount of data, if they are all small tables, you can use DM directly in one step without any extra operations. If the amount is large, it’s better to use Dumpling + Lightning.

| username: 小龙虾爱大龙虾 | Original post link

You can use dumpling to export.

| username: Kongdom | Original post link

:thinking: If it’s just 210,000 tables, the mysqldump I mentioned would be completely sufficient. If you also need to consider the data volume, then you need to decide on the method based on the data volume.

| username: 每天当牛马 | Original post link

There are just many tables, but the data volume in each table is not large.

| username: oceanzhang | Original post link

Can the mysqldump output be directly sourced using the mysql client?

| username: zhanggame1 | Original post link

TiDB has Dumpling, and using it to export MySQL is also not a problem.

| username: xingzhenxiang | Original post link

Export with Dumpling, then import with Lightning. I don’t see any limitations on the number of tables in a single database. For other limitation information, please refer to the documentation: TiDB 使用限制 | PingCAP 文档中心

| username: 每天当牛马 | Original post link

I encountered this problem during import. There is only the table structure, no data in the table. Can you help me take a look?

| username: xingzhenxiang | Original post link

It looks like the port cannot be connected.

| username: 每天当牛马 | Original post link

The cluster’s PD appears to be running, and the port is also functioning normally. Is there any solution for this?

| username: xingzhenxiang | Original post link

Did you choose physical import or logical import? I didn’t understand the configuration file.

| username: 每天当牛马 | Original post link

I don’t quite understand how to write the configuration file. It’s about exporting the MYSQL data from server A, copying the exported SQL to server B, and importing it into TIDB. Which method should I choose for this?

| username: xingzhenxiang | Original post link

First, take a look at the documentation to get an understanding:

| username: 这里介绍不了我 | Original post link

Refer to the configuration file
TiDB Lightning Configuration Parameters | PingCAP Documentation Center

| username: Jiawei | Original post link

mysqldump single-threaded is a bit slow. How about trying mysqlpump or mydumper directly?

| username: 不想干活 | Original post link

Is the network down?