Craig Sanders: backup-mysql.sh
A bash script to backup mysql databases, with separate schema and plain-text dump files (INSERT commands) for each database. Makes it easy to restore individual databases or copy them into dev/test servers. Keeps 30 days worth of backups in separate YYYY-MM-DD directories.
Also dumps the mysql grants to a separate file mysql-grants.txt , and creates a sometimes conveniently useful mysql-create-databases.txt containing CREATE DATABASE commands.
Based on my similar backup script for postgresql databases.
#! /bin/bash
# mysql backup script
#
# $Id: backup-mysql.sh,v 1.8 2013/06/21 02:20:39 cas Exp $
#
# by Craig Sanders <cas@taz.net.au>
# this script is public domain. do whatever you want with it.
# set user/password here, or leave undefined to rely on ~/.my.cnf
#MYSQL_USER="root"
#MYSQL_PWD="SECRET"
[ -n "$MYSQL_USER" ] && ARGS="$ARGS -u$MYSQL_USER"
[ -n "$MYSQL_PWD" ] && ARGS="$ARGS -p$MYSQL_PWD"
DATABASES=$(mysql $ARGS -D mysql --skip-column-names -B -e 'show databases;' egrep -v 'information_schema' );
BACKUPDIR=/var/backups/mysql
YEAR=$(date +"%Y")
MONTH=$(date +"%m")
DAY=$(date +"%d")
DATE="$YEAR-$MONTH/$YEAR-$MONTH-$DAY"
# make sure that perms on all created files/dirs are rwxr-x---
umask 0027
mkdir -p "$BACKUPDIR/$DATE"
cd "$BACKUPDIR/$DATE"
mysql $ARGS -Bse "SELECT CONCAT('SHOW GRANTS FOR \'', user ,'\'@\'', host, '\';') FROM mysql.user" \
mysql $ARGS -Bs \
sed 's/$/;/g' > mysql-grants.txt
# "create database" lines, for easy cut-and-paste
> mysql-create-databases.txt
for i in $DATABASES ; do
echo "CREATE DATABASE $i;" >> mysql-create-databases.txt
done
ARGS2="--skip-opt --no-create-db --no-create-info --single-transaction --flush-logs"
for db in $DATABASES ; do
echo -n "backing up $db: schema..."
mysqldump $ARGS --no-data $db > $db.schema.sql
echo -n "extended..."
mysqldump $ARGS $ARGS2 --extended-insert $db > $db.data.extended.sql
# uncomment if you want complete-insert dumps too.
#echo -n "data...complete..."
#mysqldump $ARGS $ARGS2 --complete-insert $db > $db.data.complete.sql
echo -n "compressing..."
gzip -9fq $db.schema.sql $db.data.extended.sql #$db.data.complete.sql
echo "done."
done
echo deleting backups older than 30 days:
find "$BACKUPDIR" -mindepth 1 -a -type d -mtime +30 -print0 xargs -0r rm -rfv
backup-mysql.sh is a post from: Errata
The
This is part 1 in 

One of
Mir is Canonical's equivalent to Wayland - a display server, responsible for getting application pixmaps onto a screen. It's intended to scale from mobile devices to the desktop, and as such is expected to turn up in Ubuntu Phone before too long[1]. There's already plenty of discussion about whether the technical differences between Wayland and Mir are sufficient to justify Canonical going their own way, so I'm not planning on talking about that.
Last year, I applied for academic,

Today, she's introduced
A Queensland pensioner made
The scariest thing is that if Australians see through this racist charade and refuse to vote for it, we could end up with something equally obnoxious: the
Recently, there's been discussions on IRC and the debian-devel mailing
list about how to notify users, typically from a cron script or a
system daemon needing to tell the user their hard drive is about to
expire. The current way is generally "send email to root" and for
some bits "pop up a notification bubble, hoping the user will see
it". Emailing me means I get far too many notifications. They're
often not actionable (
When the
Sorry
The purpose of a backup is to allow you to recover from a disaster with
reasonable cost and effort. If you delete a file you shouldn't have,
or make changes that you shouldn't have, backups are meant to save you
from having to re-create the file, or undo a large amount of steps.
Speaking very broadly, any copy of your live data is a backup, but this
is a uselessly broad definition. For example, if you use an automatic
synchronisation system such as Dropbox or git-annex, to keep your live
data in sync between two computers, you could pretend they're backups
of each other. However, unless the synchronisation also allows you to
keep a history of file versions, it's not a very good backup. If you
delete your precious file on one computer, and it gets then deleted on
the other computer as well, automatically, perhaps in seconds, then the
backup is not of much use.
Another common assumption is that a RAID array works as a backup. RAID
is an excellent technology that allows you to combine several hard disks
so that they protect you against loss of data in case of disk failure.
If one disk fails, the others have enough data to re-create the data on
the failed disk, using either full copies (RAID-1) or error correction
codes (RAID-5, RAID-6). This is not a backup. It doesn't protect you
against accidental file deletions. There is also no backup history.
A version control system is very much like a backup. It stores copies
of many of the versions of your project. However, in most version
control systems it's fairly easy to make changes that lose history. Ask
anyone who has used
With the PRISM scandal, there has been some talk about encrypted
communication systems. For instance,