wp db export <file>

Exports the database to a file or to STDOUT

Arguments

NameDescription
fileThe name of the SQL file to export. If ‘-‘, then outputs to STDOUT. If omitted, it will be ‘{dbname}-{Y-m-d}-{random-hash}.sql’

Options

NameDescription
--dbuser <value>Username to pass to mysqldump. Defaults to DB_USER
--dbpass <value>Password to pass to mysqldump. Defaults to DB_PASSWORD
--field=valueExtra arguments to pass to mysqldump. Refer to mysqldump docs
--tables <tables>The comma separated list of specific tables to export. Excluding this parameter will export all tables in the database
--exclude_tables <tables>The comma separated list of specific tables that should be skipped from exporting. Excluding this parameter will export all tables in the database
--include-tablespacesSkips adding the default –no-tablespaces option to mysqldump
--porcelainOutput filename for the exported database
--defaultsLoads the environment’s MySQL option files. Default behavior is to skip loading them to avoid failures due to misconfiguration