Skip to content

Instantly share code, notes, and snippets.

@dubgeiser
Created March 31, 2012 22:58
Show Gist options
  • Select an option

  • Save dubgeiser/2269368 to your computer and use it in GitHub Desktop.

Select an option

Save dubgeiser/2269368 to your computer and use it in GitHub Desktop.
Delete all tables in a MySQL database.
echo 'show tables;' | mysql -uUSER -pPASSWORD DBNAME | sed '1d' | sed -E 's/^(.*)$/DROP TABLE IF EXISTS `\1`;/' | mysql -uUSER -pPASSWORD DBNAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment