I always make backup using "backup and migrate" module. But now, need to automate this process using scripts.

When execute backup using "backup and migrate" this module generate .mysql file with approximately 3.3 MB(compacted) and 9MB(uncompacted) , but using the following script command, file have 17MB(compacted) and 53MB+(uncompacted) and .sql extension.

mysqldump -u user_mysql -pMY_PASS  --databases my_database | gzip > /home/my_user/my_docs/database.sql.gz

How generate ".mysql" extension file using "mysqldump"?

  • Interesting question that I don't think we have here. I'll give time for someone else to answer, but as a side note you can run B&M from drush, and it will be the exact same backup as if you did it from the UI (or cron).
    – mpdonadio
    Aug 10, 2016 at 20:07
  • Yeah, I have backup / migrate email me backups every day on cron. I think the larger size comes from tables like form cache which can get big. Aug 11, 2016 at 4:01
  • 1
    Maybe you are ignoring some tables using BAM as per Niall. That's the reason that I think. With mysqldump you are dumping the whole DB including cache bins.
    – Gulok
    Aug 11, 2016 at 10:09

1 Answer 1


My hosting is a non dedicated version, so, I don't install drush. But I found a good solution. In config BAM (/admin/config/system/backup_migrate) have an tab "Schedules". In this option u can add backup schedule. Excellent solution, because winscp script (my script backup hosting) will get .mysql.gz generated in BAM private folder automatically. Additionally, about file size backup, BAM really exclude some data tables. This option is personalizable in "/admin/config/system/backup_migrate/profile/list/edit/default", "DEFAULT DATABASE BACKUP OPTIONS" option "Exclude the data from the following tables".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.