Revision: 5004
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 4, 2008 04:18 by berkes
Initial Code
mysql -u[username] -p[password] -h[host] [databasename] -e "show tables like 'foo_%';" -N | awk '{ print "DROP TABLE " $1 ";" };' | mysql -u[username] -p[password] -h[host] [databasename]
Initial URL
Initial Description
This script removes (DROPS) all tables that start with foo_. Usefull if you had some CMS or application that (ab)uses table prefixing, and want to clean 0ut your database. NOTE: the data is remove FOREVER! So take good casre: make backups and all the likes. Try on a test-database first!
Initial Title
Remove all tables with a certain pattern from the database
Initial Tags
mysql
Initial Language
Bash