Skip to main content
VeloDB Cloud 26.x is based on Apache Doris 4.x. See Version Mapping.

MySQL Dump

mysqldump is MySQL's logical export tool. Use it with a VeloDB Cloud warehouse to create SQL dumps of table schemas or small data sets on your client. Review the generated statements before importing them into another warehouse. A dump is not a complete warehouse backup and does not preserve managed recovery state or organization settings.

When to use mysqldump​

ScenarioGuidance
Development and testingUseful for small test fixtures and schema comparisons.
Schema exportUse --no-data to export DDL without table rows.
Small data exportUse it when a SQL dump is more useful than columnar or CSV files. Measure elapsed time for your data set.
Large production exportPrefer EXPORT or SELECT INTO OUTFILE for bulk data.

Prerequisites​

  • Install mysqldump and the MySQL command-line client on your computer.
  • Obtain your warehouse's MySQL host, port, SQL username, and required TLS options from its connection instructions. Your client must be allowed to connect to the warehouse. This applies to SaaS and BYOC warehouses.
  • Use a warehouse SQL user with access to the databases and tables being exported. SQL privileges needed by the client depend on its options and the objects included in the dump.
  • Replace <warehouse-host>, <mysql-port>, and <username> in the commands below. Replace the sample database and table names with your own. --password prompts for the password rather than putting it in shell history.
  • The commands below use a MySQL 8 client with --ssl-mode=REQUIRED. Use the certificate and identity-verification options from your warehouse's connection instructions when provided. If you use a different client, check its equivalent TLS options.
  • Include --no-tablespaces because the query engine does not implement MySQL tablespaces. This option alone does not guarantee compatibility with every client version or dump option.

Export data or schemas​

Export a table's schema and data​

Write one table to a SQL dump
mysqldump --host='<warehouse-host>' --port='<mysql-port>' --user='<username>' \
--password --ssl-mode=REQUIRED --no-tablespaces \
test table1 > table1.sql

Export only a table's schema​

Export DDL without rows
mysqldump --host='<warehouse-host>' --port='<mysql-port>' --user='<username>' \
--password --ssl-mode=REQUIRED --no-tablespaces \
--no-data test table1 > table1-schema.sql

Export multiple databases​

Include database statements and their tables
mysqldump --host='<warehouse-host>' --port='<mysql-port>' --user='<username>' \
--password --ssl-mode=REQUIRED --no-tablespaces \
--databases test1 test2 > databases.sql

--databases adds database selection and creation statements. Review them before importing into an existing warehouse.

Export all accessible databases​

Create a dump across databases
mysqldump --host='<warehouse-host>' --port='<mysql-port>' --user='<username>' \
--password --ssl-mode=REQUIRED --no-tablespaces \
--all-databases > all-databases.sql

Use this scope only when needed. A client may query system schemas or metadata that differ from MySQL. Prefer explicit user databases if this option encounters compatibility errors.

Check the command's exit status and error output before using the file. An existing .sql file alone does not prove that the dump completed. Protect dump files because they can contain sensitive data. For client options, see the MySQL mysqldump manual.

Import a reviewed dump​

Inspect the SQL file for database selection, DDL, and any destructive statements. Connect to the destination warehouse using its own host, port, SQL user, and TLS settings. For the single-table dump above, select an existing destination database:

mysql --host='<destination-warehouse-host>' --port='<mysql-port>' --user='<username>' \
--password --ssl-mode=REQUIRED --database='<destination-database>'

Run the MySQL client's source command:

source table1.sql;

Verify the table definition and row count in the destination. If the source is changing during the dump, do not assume a consistent snapshot across tables. Dump and import operations consume warehouse compute. Remove local dump files when no longer needed, according to your data retention policy.

Common errors​

SymptomWhat to check
Connection or authentication failureUse the warehouse endpoint, SQL credentials, allowed network path, and required TLS options.
Tablespace-related errorInclude --no-tablespaces.
Unsupported metadata query or client statementCheck the client version and enabled dump options. Try an explicit database/table scope and review the MySQL manual.
Import fails or targets an unexpected databaseInspect DDL, database statements, and object names before retrying. Do not repeatedly import a partially applied dump without checking its effects.

See also​