We can drop tables using the query “droptable table name;”. We van do it only one by one.So this is impractical when there is lot of tables. In such situation we can use the below given command:
mysql -u <username> -p<password> <database name> -e “show tables” | grep -v Tables_in | grep -v “+” | \gawk ‘{print “drop table ” $1 “;”}’ | mysql -u <username> -p<password> <database name>
Commonly arising problems:
1. gawk(Gnu awk): you must install this module.gawk is a pattern cheking language.
2. If you give password with this command(in the place of <password> you may avoid the space between -p and password.