# mysqldump data only
In some cases you may want to create a database dump only with the data, without including any information about the tables. mysqldump
allows you to do that by passing the --no-create-info
flag.
# Don't write CREATE TABLE statements
mysqldump --no-create-info my_database > my_backup.sql
In case you are using triggers, the command --skip-triggers
should be added as well.
# Skip the triggers
mysqldump --no-create-info --skip-triggers > my_backup.sql
Additionally, if you want to get rid of additional information such as comments, add the --compact
flag. If you want to find more about --compact
, here we have a full article about it.
mysqldump --no-create-info --skip-triggers --compact > my_backup.sql
In case the option --database
is used, you need to add the option --no-create-db
to not include the CREATE DATABASE
statements in the dump.
# Don't write CREATE DATABASE statements
mysqldump --no-create-info --skip-triggers --compact --no-create-db > my_backup.sql