Page 1 of 1
backups
Posted: Sun Nov 26, 2006 9:14 pm
by elecktricity
whats the easiest way to make backups of big databases with php? I tried a few ideas but they didnt seem to work well they kept timing out ect? I dont want to install anything just something I can create with php or something else simple.
Posted: Sun Nov 26, 2006 9:25 pm
by feyd
Using the results from SHOW DATABASES and SHOW TABLES, one can build a tree of how the tables are oriented. You can then use SHOW CREATE TABLE against these names to create the structure queries. Now you have to be careful of the tables using InnoDB as a storage engine as they could easily be dependent on another table existing first. ... Granted there are a few syntax ways around that.
After you export the structure, you can begin dumping the individual tables' data. I'd count the number of queries performed and try to chop them at a certain length and move to another file.
Posted: Sun Nov 26, 2006 10:32 pm
by elecktricity
i tried something like your approact, it kept timing out or giving me an error saying its used to much memory on it...
Posted: Sun Nov 26, 2006 10:45 pm
by feyd
I'm guessing you kept the whole thing in memory until you finished a file? I was suggesting outputting as you go.
You may need to call set_time_limit() with a large value, or zero, depending on needs.
Posted: Mon Nov 27, 2006 8:56 am
by elecktricity
it hasnt given me a time limit error, its a memory error...
Posted: Mon Nov 27, 2006 9:36 am
by Burrito
you could call mysqldump with exec().
Posted: Mon Nov 27, 2006 11:07 am
by RobertGonzalez
Does it have to be done with PHP? If so, can you tap into phpMyAdmin for how they do it?
Posted: Tue Nov 28, 2006 1:24 pm
by elecktricity
no it really dosnt have to be done in php but im more famaliar with it so I thought it would be easier, but if you have any other ideas shoot ^^
Posted: Sat Dec 02, 2006 3:47 am
by pedrotuga
elecktricity wrote:no it really dosnt have to be done in php but im more famaliar with it so I thought it would be easier, but if you have any other ideas shoot ^^
then why not use the mysqldump instead of php. I don't think that will cause memory errors, timouts or whatsoever.