This is a shell script that backs up your MySQL servers. It can talk to as many servers as you'd like (remote or local), and has some features to filter out specific databases and table names.
To backup databases locally, you'll only need bash and gzip, which ship with just about all Linux distros.
To backup to FTP, you'll need the 'ftp' program.
To backup to email, you'll need the 'mutt' program.
Databases you want to backup, separated by a space; leave empty to backup all databases on this host.
DBNAMES[0]="db1 db2"
Your MySQL username.
DBUSER[0]="root"
Your MySQL password.
DBPASS[0]="password"
Your MySQL server's location (IP address is best).
DBHOST[0]="localhost"
Tables you want to backup or exclude, separated by a space; leave empty to back up all tables.
DBTABLES[0]="db1.table1 db1.table2 db2.table1"
If you set this to 'include', it will backup ONLY the tables in DBTABLES, 'exclude' will backup all tables BUT those in DBTABLES.
DBTABLESMATCH[0]="include"
If you want to give mysqldump
other options, include them here.
DBOPTIONS[0]="--quick --single-transaction"
Email addresses to send backups to, separated by a space.
EMAILS="address@yahoo.com address@usa.com"
This is the subject of the email that you'll get.
SUBJECT="MySQL backup on $SERVER ($DATE)"
FTPHOST[0]="ftphost"
FTPUSER[0]="username"
FTPPASS[0]="password"
FTPDIR[0]="backups"
For each server you're backing up, you will need to copy/paste the block under MySQL Settings
and increment the key in brackets (e.g. the first server will be 0, the next will be 1, and so on).