Want a quick and dirty way to Truncate all the tables in a MySQL DB? You can use the following one line script.
mysqldump -ppassword YourDBName –no-data dumpfile | mysql dumpfile
What this does is uses mysqldump to output all the tables in the database “YourDBName” into a dump file. This dump file contains drop statements, and create table statements for each table in the database. What this effectively does is drops every table, and recreates it WITHOUT any data inside. Be very careful, since this is a very powerful script, it has the ability to completely wipe out your database with no hope of recovery unless you have a current backup.
- MySQL – Select rows from a table when a field starts with a number
- B-17 E-Z Goin’ and the Sonderkommando Elbe – Buchen Raid