Just an advice, running a mysql slave server might also be a good idea
instead of doing regular dumps.

Adi

On Thu, Jul 22, 2010 at 2:40 AM, Simon J Welsh <[email protected]> wrote:

> If you can use exec, or similar:
>
> <?php
>
> `mysqldump -u user --password=<password> database | mysql -u user
> --password=<password> backup_database`
>
> Alternatively, connect, grab all tables, foreach table use 'SHOW CREATE
> TABLE `tablename`', drop the table from backup, if it exists, create the new
> one in backup, INSERT INTO `backup`.`table` SELECT * FROM `main`.`table`
>
> On 22/07/2010, at 8:55 AM, Brendan Brink wrote:
>
> > Hi there,
> >
> > Can someone please give a recommendation?
> >
> > I am wanting to write a php script that will automatically backup one
> > database to another database at regular intervals.
> >
> > Perhaps something someone has used in past and proved useful would be
> > much appreciated.
> >
> > Cheers
> > brendan.
> >
> > --
> > NZ PHP Users Group: http://groups.google.com/group/nzphpug
> > To post, send email to [email protected]
> > To unsubscribe, send email to
> > [email protected]<nzphpug%[email protected]>
>
> ---
> Simon Welsh
> Admin of http://simon.geek.nz/
>
> Who said Microsoft never created a bug-free program? The blue screen never,
> ever crashes!
>
> http://www.thinkgeek.com/brain/gimme.cgi?wid=81d520e5e
>
>
>
>
> --
> NZ PHP Users Group: http://groups.google.com/group/nzphpug
> To post, send email to [email protected]
> To unsubscribe, send email to
> [email protected]<nzphpug%[email protected]>
>

-- 
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]

Reply via email to