Mysql: Drop / Truncate all tables in a database.
I had a need today to maintain the database schema but clear the data itself.
Here’s the little command line snippet.
mysql -u -p -D -Nse 'show tables' | while read TABLE; do mysql -u -p -D -e "truncate table $TABLE"; done
|Mysql – extract data from large .sql dumps
|Mysql – turn off word wrap
|Mysql: Find a table by its name