keeping in mind the quick and dirty ethics, no boring explanations, here’s my approach on how to backup wordpress’ mysql database. it’s useful to do it before upgrades, long holidays in southamerica, dull sundays, political p.o.v. modifications and because it is a healthy habit.
this is my script (if you carefully google it, you will find out that it is not an original idea)
#!/bin/sh
DBBDATE=`date +%Y-%m-%d_%H.%M.%S`
DB_USER=user
DB_ACCESS=xxxxxxxx #password
DB_NAME=wpdatabse #how you named your wp database
BLOG=TODO
mysqldump --opt -u $DB_USER -p$DB_ACCESS $DB_NAME > database_$BLOG-at-$DBBDATE.sql
#un comment the following line to make a local copy
#cp database_$BLOG-at-$DBBDATE.sql /mnt/backups
#un comment the following line to make a remote copy
#scp -P 1234 database_$BLOG-at-$DBBDATE.sql user@remote.unit.com:/mnt/backups/
Stuff written in red MUST be changed, excepting only wise people that have a FQDN like “remote.unit.com” and a partition called ‘/mnt/backups/’ or so.