Exporting Data or Table Structures
Doris has supported exporting data or table structures through the mysqldump
tool after version 0.15
Examplesβ
Exportβ
-
Export the table1 table in the test database:
mysqldump -h127.0.0.1 -P9030 -uroot --no-tablespaces --databases test --tables table1
-
Export the table1 table structure in the test database:
mysqldump -h127.0.0.1 -P9030 -uroot --no-tablespaces --databases test --tables table1 --no-data
-
Export all tables in the test1, test2 database:
mysqldump -h127.0.0.1 -P9030 -uroot --no-tablespaces --databases test1 test2
-
Export all databases and tables
mysqldump -h127.0.0.1 -P9030 -uroot --no-tablespaces --all-databases
For more usage parameters, please refer to the manual ofmysqldump
Importβ
The results exported by mysqldump
can be redirected to a file, which can then be imported into Doris through the source command source filename.sql
Noticeβ
-
Since there is no concept of tablespace in mysql in Doris, add the
--no-tablespaces
parameter when usingmysqldump
-
Using mysqldump to export data and table structure is only used for development and testing or when the amount of data is small. Do not use it in a production environment with a large amount of data.