Quick Backup of All MySQL Databases

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;

Tags: , ,

Saturday, October 17th, 2009 Bash, Linux, Mac, MySQL, Unix

Leave a Reply