-
Notifications
You must be signed in to change notification settings - Fork 3
bkuhl edited this page Apr 17, 2012
·
10 revisions
MySQL Backup Pro is a simple shell script controlled by a configuration file. When the script runs it will perform backups as it is configured and output a result of what took place.
Example output:
Loading config file (/path/to/mysql-backup.conf)
Created backup directory (/path/to/backups/latest/2012-02-11)
Backing up MySQL databases...
- database1...
- database2...
- database3...
- database4...
Performing backup rotation...
Backups rotation complete
MySQL backup is complete
--------------
/usr/local/mysql/bin/mysql Ver 14.12 Distrib 5.0.18, for pc-linux-gnu (i686) using readline 5.0
Connection id: 579247
Current database:
Current user: root@My.server
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.0.26
Protocol version: 10
Connection: 192.168.255.xx via TCP/IP
Server characterset: utf8
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
TCP port: 3306
Uptime: 37 days 15 hours 8 min 41 sec
Threads: 10 Questions: 225667986 Slow queries: 147 Opens: 326131 Flush tables: 1 Open tables: 64 Queries per second avg: 69.408
--------------
Simply configure a few settings in mysql-backup.conf
and add a cron:
15 3 * * * /path/to/mysql-backup.sh
Be sure your config file is in the same directory. This will run daily at 3:15 AM server time.
It's a good idea to setup daily emails so you know if your backups failed. Use the following command to get the output delivered to your inbox:
15 3 * * * /path/to/mysql-backup.sh 2>&1 | /usr/bin/mail -s "Backup Report" myEmail@gmail.com