Skip to content

Instantly share code, notes, and snippets.

@jbonney
Created August 30, 2013 22:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save jbonney/6394749 to your computer and use it in GitHub Desktop.
Save jbonney/6394749 to your computer and use it in GitHub Desktop.
MySQL dump to export data only (no DB schema nor table instructions). Particularly useful when exporting a Rails DB to re-import it afterwards in a DB that has been created through `rake db:drop db:create db:migrate`.
mysqldump --user="username" --password="password" --skip-triggers --compact --no-create-info --ignore-table="database_name.schema_migrations" --ignore-table="database_name.table_populated_through_migration" "database_name" > "dump.sql"
@kwerle
Copy link

kwerle commented May 1, 2020

Probably also add --ignore-table="database_name.ar_internal_metadata" these days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment