Quick Backup of All MySQL Databases

On October 17, 2009, in Bash, Linux, Mac, MySQL, Unix, by Code Monk

Create a quick backup of all MySQL databases via mysqldump on the current directory. Replace USERNAME and PASSWORD with your own.

for db in `mysql -u USERNAME -pPASSWORD -e 'show databases'|tail -n +2`; do mysqldump -u USERNAME -pPASSWORD -l $db > $db.sql; done;

Tagged with:  

2 Responses to “Quick Backup of All MySQL Databases”

  1. Pit Silas says:

    Thanks for writing about this. There’s a heap of good tech info on the internet. You’ve got a lot of that info here on your site. I’m impressed – I try to keep a couple blogs reasonably live, but it’s a struggle sometimes. You’ve done a big job with this one. How do you do it?

Leave a Reply