Dump only the data with mysqldump without any table information
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
A data-only dump is useful when schema is already managed elsewhere and you only need table contents. Typical cases include loading seed data, moving production rows into a staging copy, or refreshing analytics snapshots. mysqldump supports this directly with options that suppress CREATE TABLE statements and keep output focused on INSERT data.
Data-Only Dumps with mysqldump
The core option is --no-create-info. With that flag, output contains row inserts but no table definitions.
What this does:
- Connects to
app_dbasbackup_user. - Prompts for a password securely instead of putting it on the command line.
- Writes only data statements into
app_db_data.sql.
If you want to avoid locking behavior and preserve transactional consistency for InnoDB tables, combine with --single-transaction.
--quick streams rows rather than buffering large result sets in client memory, which helps for big tables.
Targeting Tables and Rows
You can dump only selected tables by listing them after the database name.
You can also filter rows with --where for one table at a time. This is helpful for incremental exports.
Important behavior:
--whereapplies to a single table dump command.- If you need filters for multiple tables, run separate dump commands.
- Quoting matters, especially for dates and string literals.
For repeatable operations, place credentials in a MySQL option file rather than shell history.
Then run:
Consistent Snapshots and Performance
Data-only dumps are still backups, so consistency rules matter. In InnoDB-heavy databases, --single-transaction starts one consistent read view. That usually avoids long blocking writes.
For mixed engines:
- InnoDB tables are transaction-safe with
--single-transaction. - MyISAM tables are not transaction-safe and may require table locking for a coherent snapshot.
If you need deterministic order for diffing files, consider --skip-extended-insert so each row is written as a separate insert statement. This produces larger files but easier review.
Compression is usually worth it for transfer and storage.
Related reading
- Duplicate a document in MongoDB using a new _id
- Duplicate delete query in binary log of MySql Master
- Duplicating a MySQL table, indices, and data
- Duplicating a MySQL table, indices, and data
- During local development with Kubernetes/minikube, how should I connect to postgres database running on localhost?
- DyanamoDB SCAN with nested attribute
- Dynamically partitioning a table from main to remote mySQL server
- dynamo db local shell doesn't list tables using docker image

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.