Very simple MySQL backup via FTP script
November 9th, 2007 by Remy Blaettler
There are tons of pretty enhanced scripts out there to make backup and also to copy them to FTP sites, but what I needed was just something really simple to have my daily backup saved somewhere.
The script below will dump your DB into the backup.sql file and copy it to an FTP server of your choice into the root directory of that user. Can’t be any simpler.
Here it is:
The BackupAndFTP.cmd file:
mysqldump -uuserName -ppassword DBName > backup.sql ftp -s:ftpcommands.txt ftp.hostname.com
The ftpcommands.txt file:
username password binary put backup.sql bye
Just put both code blocks into an individual file, replace the usernames and passwords (first for MySQL and then for the FTP access), replace DBName with the name of the database you wanna save and that’s it.
