|
|
MySQL Backup procedures? |
| mysqldump -a is great, but sometimes you just want a bunch of individually reinstallable dbs. Here's a standard way to do it:
Create a table list of databases: mysql -uroot -ppass -B -e "show databases;" | grep -v "Database" > dbs Edit this list appropriately Create two batch files:
backitallup: #!/usr/local/bin/bash for i in `cat dbs`; do ./backitup $i; done tar -zcf servername_sql-backups_`date +%Y_%m_%d`.tar.gz *.sql rm *.sqlbackitup: #!/bin/sh echo Backing up $1 ... mysqldump -uuser -ppass -Q $1 > $1.sqlThe -Q (quote) is optional, but can get past some sites that mysqldump might balk because of spaces in names or something.
I got this from a comment: at http://www.wilshireone.com/article/2/automatic-mysql-backups | |
| [Append to This Answer] |
| Next: |
|
| ||||||||