Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##
- # Bulk drop mysql databases
- # This is a super-simple script to take an array of databases and drop them from mysql.
- # It goes without saying, but, be extra careful with this.
- ##
- # mysql credentials
- user="root"
- password="root"
- # array of databases to drop -- update with actual database names
- targets=("db_a" "db_b" "db_c")
- # loop through the databases
- for target in ${targets[@]}; do
- echo "Deleting DB: $target"
- mysql -u$user -p$password -Bse "drop database $target"
- done
Add Comment
Please, Sign In to add comment