Possible Duplicate:
Truncate all tables in a MySQL database in one command?
I need to delete, or drop, all the tables in a MySQL database with single command without knowing the tablenames. Is this possible?
Possible Duplicate:
Truncate all tables in a MySQL database in one command?
I need to delete, or drop, all the tables in a MySQL database with single command without knowing the tablenames. Is this possible?
drop database YOUR_DATABASE;
/* this will delete all the tables for this database */
create database YOUR_DATABASE;
/* added back the database namespace */
Rather long, but try this command (after replacing the obvious things):
mysql --user=YOUR_USERNAME --password=YOUR_PASSWORD -BNe "show tables" YOUR_DBSCHEMA_NAME | tr '\n' ',' | sed -e 's/,$//' | awk '{print "SET FOREIGN_KEY_CHECKS = 0;DROP TABLE IF EXISTS " $1 ";SET FOREIGN_KEY_CHECKS = 1;"}' | mysql --user=YOUR_USERNAME --password=YOUR_PASSWORD YOUR_DBSCHEMA_NAME