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
https://forums.phpfreaks.com/topic/119094-backup-mysql-with-php/
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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.