Skip to content

Instantly share code, notes, and snippets.

@usayamadx
Last active August 24, 2021 03:22
Show Gist options
  • Save usayamadx/ff046dfef9ae31c5f85724a261d785bc to your computer and use it in GitHub Desktop.
Save usayamadx/ff046dfef9ae31c5f85724a261d785bc to your computer and use it in GitHub Desktop.
mysql export/import commands
/* -------------
dump : export
------------- */
// schema + records
mysqldump -u user -p database_name > database_name_`date +%Y%m%d-%H%M%S`.sql
// schema
mysqldump -u user -p -d database_name > database_name_`date +%Y%m%d-%H%M%S`.sql
// tables
mysqldump -u user -p -t database_name table_name_a table_name_b > database_name_tables_`date +%Y%m%d-%H%M%S`.sql
/* -------------
dump : import
------------- */
mysql -u user -p database_name < file_name.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment