Skip to content

Instantly share code, notes, and snippets.

@bannostookaylo
Last active June 26, 2017 14:20
Show Gist options
  • Save bannostookaylo/22caf95abe82494e1d4804c9cde17b72 to your computer and use it in GitHub Desktop.
Save bannostookaylo/22caf95abe82494e1d4804c9cde17b72 to your computer and use it in GitHub Desktop.
## Drop (i.e. remove tables)
mysql -Nse 'show tables' DATABASE_NAME | while read table; do mysql -e "drop table $table" DATABASE_NAME; done;
## Truncate (i.e. empty tables)
mysql -Nse 'show tables' DATABASE_NAME | while read table; do mysql -e "truncate table $table" DATABASE_NAME; done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment