one-liners command-line scripts

Delete all tables in a MySQL database

Quick and dirty on linux based systems:

mysql -u$DB_USER -p$DB_PASS -D$DB_NAME -h$DB_HOST -e "show tables" -s   \
  | awk \
    -v DB_USER=$DB_USER \
    -v DB_PASS=$DB_PASS \
    -v DB_NAME=$DB_NAME \
    -v DB_HOST=$DB_HOST \
    '{ print "mysql -u"DB_USER" -p"DB_PASS" -D"DB_NAME" -h"DB_HOST" -e \"DROP TABLE "$1"\""}' \
  | sh