Drop all databases matching prefix
Posted by jake | Filed under Programming Ducks
Shell script to drop all MySQL databases with the prefix ‘rupture’:
mysql -u user_name -e 'show databases' | grep '^rupture' | xargs -I "@@" echo mysql -u user_name -e '"DROP DATABASE @@"' > temp chmod +x temp ./temp