This article applies to manual migrations for the Version 1 (Legacy) Cloud Database.
For the latest platform documentation, please visit docs.nexaa.io.
When migrating a large database to the Cloud, pushing a single massive dump file can lead to timeouts or memory issues. To ensure a smooth migration, we recommend splitting your dump process into two stages: Structure and Data.
Step 1: Exporting the Structure (Schema)
First, we export the "skeleton" of the database (tables, views, triggers) without the actual data. This allows you to create the empty tables on the Cloud Database first, which is very fast.
# Syntax: mysqldump -u [user] -p --no-data [database_name] > structure.sql
mysqldump -u root -p --no-data my_database > structure.sql
What this does:
The --no-data flag tells MySQL to only fetch the CREATE TABLE statements. The resulting file is small and can be imported instantly.
Step 2: Exporting Data (Table by Table)
Once the structure exists on the destination, you can import the data. For large databases, it is safer to dump tables individually.
# Syntax: mysqldump -u [user] -p --no-create-info [database] [table] > table_data.sql
mysqldump -u root -p --no-create-info my_database my_large_table > table_data.sql
Key options:
-
--no-create-info: Since we already created the tables in Step 1, we don't need theCREATE TABLEcommand again. This prevents errors like "Table already exists".
Step 3: Splitting Massive Tables (Advanced)
If you have a single table with millions of rows (gigabytes of data), even a single table dump might be too large. You can split this into chunks using the --where flag.
Example: Dumping a 'logs' table in chunks based on ID or Date.
# Dump rows 1 to 100,000
mysqldump -u root -p --no-create-info --where="id < 100000" my_database my_large_table > chunk1.sql
# Dump rows 100,001 to 200,000
mysqldump -u root -p --no-create-info --where="id >= 100000 AND id < 200000" my_database my_large_table > chunk2.sql
For extremely large datasets, consider using tools like
mydumper (which supports multi-threading) instead of the standard single-threaded mysqldump.