This is a discussion on restore mysql DB every hour within the MySQL Database forums, part of the Database Forums category; I have a CMS driven website that uses MySQL as is database. I want to create a demo site that ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
CNN_news wrote:
> I have a CMS driven website that uses MySQL as is database. > > I want to create a demo site that anyone can edit but that resets its > contents every hour so changes are not permanent. > > How can I do this? > > Thanks. > Build the database to the point where you want it restored. Back it up and create a cron job to restore it once an hour. BTW, I recommend stopping MySQL while the restore is being performed. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
|
|||
|
On Mar 5, 2:04*am, CNN_news <Nagit...@gmail.com> wrote:
> I have a CMS driven website that uses MySQL as is database. > > I want to create a demo site that anyone can edit but that resets its > contents every hour so changes are not permanent. > > How can I do this? > > Thanks. try taking a snapshop of your database / tables using mysqldump then restore using cron task every hour or whenever you want to restore the data. check out http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html |
|
|||
|
Jerry Stuckle wrote:
> CNN_news wrote: >> I have a CMS driven website that uses MySQL as is database. >> >> I want to create a demo site that anyone can edit but that resets its >> contents every hour so changes are not permanent. >> >> How can I do this? >> >> Thanks. >> > > Build the database to the point where you want it restored. Back it up > and create a cron job to restore it once an hour. > > BTW, I recommend stopping MySQL while the restore is being performed. Nah. Make up tables that represent the database in the desired initial state. Then, every hour, make new copies of those tables. Then use ALTER TABLE with RENAME to rename the current tables to "old" versions, and the new copies to the current tables. Then delete the old versions. Multiple renames done in one ALTER TABLE are atomic, so you can do this with activity in the database. It's all interlocked and you don't have to shut down. Or make all the databases InnoDB databases, and in one transaction, set them back to the desired ground state. When you commit the transaction, all the changes happen as an atomic operation, without interfering with anything in progress. John Nagle |