// archives

Archive for September, 2009

How to backup your MySQL databases to separate files

I wanted to dump all my MySQL databases using the mysqldump utility, but I wanted each database to be in a separate file. I couldn’t find a solution online, so I wrote my own script. Here it is: #!/bin/sh USERNAME=admin PASSWORD=topsecret BACKUPDIR=/var/local/mysql-backups for i in $(mysql -u $USERNAME -p$PASSWORD -e “SHOW DATABASES;” –skip-column-names –batch) do […]