Innovate | Connect | Transform
ContactService statusUSD $

GICT knowledge base

mysqldump Export Scopes: Tables, Schema and Recovery Limits

Published

MySQLBackups

mysqldump can export selected databases, tables or schema, but each selection changes what you can recover. Use this reference after preparing private credentials and storage through the basic backup and restore guide. These examples assume a local compatible MySQL client/server and authorized database access.

Choose the export scope

The commands below illustrate scope, not a complete automated backup script. Replace the example names and use a new private output path each time; shell redirection can truncate an existing file before the command runs. Check every exit status and do not label a partial export successful.

One database

mysqldump --defaults-extra-file="$HOME/.mysql-backup.cnf" \
  --single-transaction --quick --no-tablespaces \
  account_database > "$HOME/private-backups/one-database.sql"

Include routines, events and triggers when they are part of the recovery scope and your account has the required privileges. A table/data export does not recreate every database-user grant or server setting.

Selected tables

mysqldump --defaults-extra-file="$HOME/.mysql-backup.cnf" \
  --single-transaction --quick --no-tablespaces \
  account_database items audit > "$HOME/private-backups/selected-tables.sql"

This excludes other tables and views. Check dependencies and do not describe the result as a complete application backup.

Schema without rows

mysqldump --defaults-extra-file="$HOME/.mysql-backup.cnf" \
  --no-data --no-tablespaces account_database \
  > "$HOME/private-backups/schema-only.sql"

--no-data intentionally omits table rows. It is useful for a schema copy, not data recovery.

Exclude a specific table

mysqldump --defaults-extra-file="$HOME/.mysql-backup.cnf" \
  --single-transaction --quick --no-tablespaces \
  --ignore-table=account_database.audit account_database \
  > "$HOME/private-backups/excluded-table.sql"

Record every exclusion. Omitting data for speed is not an acceptable complete-backup claim, and related triggers/views can still refer to the excluded table.

Multiple databases and whole-server scope

--databases accepts explicit database names and adds database-selection statements to the output. Such a dump can select or create its named databases during import; do not test it against unrelated live databases. --all-databases has wider privilege and system-schema implications and is not a routine shared-hosting account backup.

A whole-server recovery requires a DBA plan for compatible versions, system schemas, grants, settings and data outside the dump. Do not assume the existence of one SQL file makes every service recoverable.

Consistency, remote access and output files

InnoDB snapshot behavior does not extend to all storage engines, and schema changes during export can invalidate the result. Plan maintenance/locking where needed. For remote database access, configure verified TLS and scoped credentials; adding -h and a root login is not a secure universal procedure.

mysqldump normally writes SQL to standard output, but it also has a result-file option. The old claim that it cannot create an output file itself was incorrect. Output settings and platform newline behavior matter; consult the installed version’s documentation.

Test recovery in an isolated destination and inspect the exact expected objects and records. Dumps can contain explicit source-database references in views or routines; importing into a differently named database does not automatically remap those references. Use the automation guide for failure-aware scheduling rather than combining these illustrative commands into an unchecked pipeline.

Reference: official mysqldump documentation. Reviewed October 14, 2026. Scope examples were checked against synthetic local MySQL data; no whole-server recovery, remote TLS or customer export was tested.

Related guides

Account services are unavailable until the production backend is configured.