This has been covered here a number of times before ... a search of the
archive avoids the need to repeat the same info.

That being said ...

We use a cronjob (root) that calls a shell script at 3am daily.

The line in the cronjob is:
* 3 * * * /usr/local/bin/dbbakup.sh username password

The shell script:

#################################################################
#!/bin/sh
# $1 = Unix/MySQL Username
# $2 = Unix/MySQL Password

if [ ! -e /dbbakup ]
 then
  mkdir /dbbakup
fi

mysqldump -u$1 -p$2 -c --add-drop-table --add-locks --flush-logs --databases
account>/dbbakup/account.sql
mysqldump -u$1 -p$2 -c --add-drop-table --add-locks --flush-logs --databases
payroll>/dbbakup/payroll.sql
mysqldump -u$1 -p$2 -c --add-drop-table --add-locks --flush-logs --databases
contact>/dbbakup/contact.sql

#################################################################

If you wanted to ftp the resulting scripts to another server, you could add
code to the shell script to run ncftpput, etc.

Gerald Jensen


----- Original Message -----
From: "Chetan Lavti" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 12, 2002 11:16 PM
Subject: Script for Data base backup and recovery : Very essential


hi,
Can anybody tell me how can I write script for MySQL backup and
recovery.( i am newbie as per script is cencern)
I am using Innodb table type and using all the default parameters
specified in the my.cnf file (my-large.cnf)

Looking for kind response..

Thanks and regards,
Chetan Lavti











---------------------------------------------------------------------
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




---------------------------------------------------------------------
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 <mysql-unsubscribe-##L=##[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to