Jump to content

Backup Mysql with PHP


53329

Recommended Posts

I've tried a few classes to do it but none seem to work.  Is there a script out there that lets you backup certain tables?  I have a few that have over 10,000 rows in them so whenever I try to backup the whole thing with someone else's script the file either clips the last few tables or it just gives me a corrupt file.

Link to comment
Share on other sites

I've spent the last 9 and a half hours trying scripts like that but none have worked.  Like I said my database is absolutely massive.  The small tables at the beginning (alphabetically) always work but then they break as soon as they get to the first big one.

Link to comment
Share on other sites

I tried using putty but it freezes right after I input who to login as.

 

I also tried another script

 

system(sprintf(
    'mysqldump --opt -h %s -u %s -p%s %s | gzip > %s/%s/%s-%s%s%s-%s%s.gz',                                                 
    $host,
    $user,
    $pass,
    $db,
    getenv('DOCUMENT_ROOT'),
    $backupdir,
    $db,
    $year,
    $month,
    $day,
    $hour,
    $min
  )); 

 

But it gave me less that a tenth of the db.  Also I think my host disabled using exec, passthru, etc as they don't work.

 

Right now I think the only approach might be to first take the structure for all the tables then somehow do partial backups of the data in the tables.  It seems a but ridiculous though as the total size of the database is only about 10-20 megs.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.