Drop All Databases in MySQL

Here is a cool script that will drop all of your MySQL databases, all but mysql and informatoion_schema databases. I use this script when ever i want to rebuild my replication server.

mysql -uroot -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);"}' |
mysql -uroot -ppassword
The command will create the drop database statement for all the database but mysql and information_schema databases then pipe the command into mysql to execute. The output would be some thing like this:
[root@home]#  mysql -uroot -p  -e "show databases" | grep -v Database | grep -v mysql| grep -v information_schema|
grep -v bih002_bin_logs | grep -v test | grep -v OLD |gawk '{print "drop database " $1 ";select sleep(0.1);"}'
drop database callroom;select sleep(0.1);
drop database callroom_mgm;select sleep(0.1);
drop database dialogus;select sleep(0.1);
drop database limesurvey;select sleep(0.1);