Skip to main content

db:import

Import database

warning

Using the --drop or --drop-tables options will remove existing data before import. Make sure you have backups and understand the consequences before using these options.

  • Requires MySQL or MariaDB CLI tools
n98-magerun2.phar db:import [options] [<filename>]

Arguments:

  • filename - Dump filename

Options:

OptionDescription
--connection=CONNECTIONSelect DB connection type for Magento configurations with several databases
-c, --compression=COMPRESSIONThe compression of the specified file (e.g. gzip, lz4, zstd)
--zstd-level[=ZSTD-LEVEL]ZSTD compression level [default: 10]
--zstd-extra-args[=ZSTD-EXTRA-ARGS]Custom extra options for zstd
--dropDrop and recreate database before import
--drop-tablesDrop tables before import
--forceContinue even if an SQL error occurs
--only-commandPrint only mysql/mariadb command. Do not execute
--only-if-emptyImports only if database is empty
--optimizeConvert verbose INSERTs to short ones before import (not working with compression)
--skip-authorization-entry-creationDo not create authorization rule/role entries if they are missing.