Gossamer Forum
Home : Products : Gossamer Links : Discussions :

MySQL Query Help:: Cron MySQL Dump Backup & Restore.. How to??

Quote Reply
MySQL Query Help:: Cron MySQL Dump Backup & Restore.. How to??
I was wondering if anyone help me with a MySQL Query. Here is what I am planning for:
  • On our site, I am wanting to install few couple of demo scripts, and each script will have its own mysql dump
  • Every Hour, I want the cron job to restore mysql dump from a designated location, so in a way it will overwrite any edits, that end users might have done while playing with the demo.

Does anyone knows on how do I setup such cron job?

Also, is there a way to backup MySQL db, using a cron?

Thank you.

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] MySQL Query Help:: Cron MySQL Dump Backup & Restore.. How to?? In reply to
Hi,

Something like this should work:

Code:
mysql -uUSERNAME -pPASSWORD DB_NAME < /full/path/to/file.sql

..and in crontab format, something like this:

Code:
0 * * * * mysql -uUSERNAME -pPASSWORD DB_NAME < /full/path/to/file.sql

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] MySQL Query Help:: Cron MySQL Dump Backup & Restore.. How to?? In reply to
Thanks a lot Andy, I very much appreciate it. Smile

Vishal
-------------------------------------------------------