Guest User

Untitled

a guest
Dec 13th, 2017
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. ##
  2. # Bulk drop mysql databases
  3. # This is a super-simple script to take an array of databases and drop them from mysql.
  4. # It goes without saying, but, be extra careful with this.
  5. ##
  6.  
  7. # mysql credentials
  8. user="root"
  9. password="root"
  10.  
  11. # array of databases to drop -- update with actual database names
  12. targets=("db_a" "db_b" "db_c")
  13.  
  14. # loop through the databases
  15. for target in ${targets[@]}; do
  16. echo "Deleting DB: $target"
  17. mysql -u$user -p$password -Bse "drop database $target"
  18. done
Add Comment
Please, Sign In to add comment