This is the way i do it:
- write a script that will run mysqldump on the database of choice and then pipe the
result though gzip (this is only to reduce the size)
- the script also copies the new backup over the old one where every you may be
backing it up
- run this script with cron every night or whenever you want to do backups
- write another script which rotates the update logs and install the script under
crontab also
when you need to restore a backup just recreate the database you need to restore and
pipe the last database backup through the mysql program. then do the same with the
most recent update script. this should restore your database to the point at which it
was when the bad stuff happened.
Here are my scripts:
backupdb:
#!/bin/sh
backupdir=/usr/backup
bindir=/usr/local/bin
rm $backupdir/$1.gz
$bindir/mysqldump $1 | /usr/bin/gzip > $backupdir/$1.gz
rotate-update-logs:
#!/bin/sh
# only keeps 2 logs
base=servername
datadir=/usr/local/var
bindir=/usr/local/bin
cd $datadir
mv $base.002 $base.001
$bindir/mysqladmin flush-logs
These are just basic scripts but they work for me. I hope this helps.
- Dan
On 2003-04-29 00:06:05, Keneth wrote:
> Anyone know how to backup mySQL database?
>
> with best regards,
> TOM
>
>
>
>
Posted via Project Horizon
http://www.projecthorizon.com
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php