3/14/2007
Quick and Dirty MySQL Backup Script
I previously posted a Quick and Dirty MySQL Backup snippet that has gotten a bit of traffic. It works well in a pinch, but it doesn’t have any features. I use it primarily as a safety backup when performing maintenance on a MySQL server.
Several of my clients have requested a script that they can use to do on demand one-off backups. I rolled the snippet up into a very quick-and-dirty MySQL backup.
Download mysql_quick_back.sh
Installation
- Copy mysql_quick_back.sh to a directory in your path (~/bin/ for me).
- Set execute bits with
chmod 755 mysql_quick_back.sh
- Set MySQL user/pass, directory to save backups to and notification email in script configuration
# START configure
# MySQL user, needs SELECT privileges
# Create a new user with these permissions! More secure than using a user
# with full permissions
user=# MySQL password
pass=# admin email address
adminemail=# backup location without trailing slash
# set to current directory
backuppath=.
# or set to your home directory
#backuppath=/home/admin/db_backs
Usage
Simply execute the script
NOTE
For a full MySQL backup application, check out the original MySQL Backup by Peter Falkenberg Brown. MySQL Backup is robust enough to use as a daily backup. I use it on most of the servers I manage.
Popularity: 20%


