search
Categories
Sponsors
VirtualMetric Hyper-V Monitoring, Hyper-V Reporting
Archive
Blogroll

Badges
MCSE
Community

Cozumpark Bilisim Portali
How to drop all tables of the MySQL database?
Posted in Hosting & IIS7 | No Comment | 10,021 views | 27/12/2011 09:15

There is no quick way to drop all tables of a MySQL database. You can just drop the database instead. But if you just want to drop all tables, you can use following codes.

mysql -u root -pPASSWORD DatabaseName -e "show tables" | grep -v Tables_in | grep -v "+" | \gawk '{print "drop table " $1 ";"}' | mysql -u root -pPASSWORD DatabaseName

I found the code from another website but it was for password-less MySQL servers. I added password authentication.



Leave a Reply