HOEKSTRA.CO.UK

... without destroying the database. 

You can do it all in the shell:

  • Create a SQL script from the database to drop all the tables, called dropalltables.sql

$ mysql -u[pwd] -p[user] [dbname] -s -e 'show tables' | sed -e 's/^/drop table /' -e 's/$/;/' > dropalltables.sql

  • Execute the created SQL script against the database:

 

$ mysql -u[pwd] -p[user] [dbname] < dropalltables.sql