by Antonello Lobianco.
This script should to the trick (mysqldump options from here):
#!/bin/sh
mysqldump [DB_NAME] -u [DB_USER] --password=[DB_PASSWORD] --no-autocommit --single-transaction --opt -Q -C --skip-extended-insert --order-by-primary --create-options --ignore-table=[DB_NAME].mdl_cache_filters --ignore-table=[DB_NAME].mdl_cache_flags > [DB_NAME].sql
mysqldump [DB_NAME] -u [DB_USER] mdl_cache_filters mdl_cache_flags --password=[DB_PASSWORD] --no-autocommit --single-transaction --opt -Q -C --skip-extended-insert --order-by-primary --create-options --no-data >> [DB_NAME].sql
echo "Backup created!";
However I would like a confirmation that the tables mdl_cache_filters and mdl_cache_flags (and possibly others) can be truncated safelly, as I just assume it from their names but I can't get any doc over this issue.
Thank you