53329 Posted August 11, 2008 Share Posted August 11, 2008 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. Quote Link to comment Share on other sites More sharing options...
ratcateme Posted August 11, 2008 Share Posted August 11, 2008 can't you right your own script it is not that hard. Scott. Quote Link to comment Share on other sites More sharing options...
53329 Posted August 11, 2008 Author Share Posted August 11, 2008 Any useful functions I might need in that case? I just found out that my largest table has ~50k rows in it. Quote Link to comment Share on other sites More sharing options...
xtopolis Posted August 11, 2008 Share Posted August 11, 2008 Google. Results 1 - 10 of about 1,620,000 for php mysql backup. (0.13 seconds) Quote Link to comment Share on other sites More sharing options...
53329 Posted August 11, 2008 Author Share Posted August 11, 2008 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. Quote Link to comment Share on other sites More sharing options...
tibberous Posted August 11, 2008 Share Posted August 11, 2008 10,000 rows isn't really massive - it's big, but I had a table with 5.4 million rows - it took me 5 days to make. Anyway, you don't need a script, you can do everything you need to using mysql and mysqldump from the command line. Quote Link to comment Share on other sites More sharing options...
53329 Posted August 11, 2008 Author Share Posted August 11, 2008 That might work. Only problem is that I've never had to use command line before. Can you do that only using PHP? Quote Link to comment Share on other sites More sharing options...
ratcateme Posted August 11, 2008 Share Posted August 11, 2008 look up exec() Scott. Quote Link to comment Share on other sites More sharing options...
tibberous Posted August 11, 2008 Share Posted August 11, 2008 Yeah, use can use exec, passthru, shell_exec, ``, ect. To make debugging easier, I like to use full paths and Putty - once you get the command working in Putty, just paste it into your exec call. Quote Link to comment Share on other sites More sharing options...
53329 Posted August 11, 2008 Author Share Posted August 11, 2008 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. Quote Link to comment Share on other sites More sharing options...
ratcateme Posted August 12, 2008 Share Posted August 12, 2008 did you look at the first result on google http://www.php-mysql-tutorial.com/perform-mysql-backup-php.php the second example looks good to me if your hosting has disabled exec and possiable limited system Scott. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.