mysql -u USER -pPASSWORD dbname -e "show tables" | grep "[0-9A-Z][0-9A-Z]_[0-9A-Z][0-9A-Z][0-9A-Z]_blah" | gawk '{print "drop table " $1 ";"}' | mysql -u USER -pPASSWORD dbname
Monday, June 15, 2009
Delete MYSQL tables that match a pattern. Run from the command line
Not terribly safe if you use the password on the cmd line.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment