I'm going to create a cron script in PHP that periodically backs up my site's DB every 6 hours to 4 back up DBs.
I want the SQL query to back both structure and data, but any idea on how the script may look like? Is there a generic query that says 'right, take that database, and overwrite everything in that database with it'?
coopster
3:41 pm on Sep 4, 2006 (gmt 0)
Which database? For example, if it was MySQL and you are running a cron job, you don't even need to script it, just run a command [dev.mysql.com].
ahmedtheking
11:07 am on Sep 5, 2006 (gmt 0)
Yeah MySQL (hmm emails from WW have stopped again even though i've changed the email address!).
So would this work:
mysqldump --replace -u user -ppassword -v db ¦ mysql --host=localhost -C dbbackup