Skip to content

Instantly share code, notes, and snippets.

@alchemycs
Created September 16, 2012 11:22
Show Gist options
  • Save alchemycs/3732046 to your computer and use it in GitHub Desktop.
Save alchemycs/3732046 to your computer and use it in GitHub Desktop.
Create an SQL file that will drop all non-system databases
# Create an SQL file that will drop all non-system databases
mysql -u root -p -e "show databases" | grep -v Database | grep -v mysql| grep -v information_schema| grep -v test | grep -v OLD |gawk '{print "drop database " $1 ";select sleep(0.1);"}' > drop_all_databases.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment