Open IrishTLR opened 3 years ago
Hi, only came across this project today and am already loving and using it. Just wondering, is there an option to dump all tables in individual files rather than the entire database as one file? Our databases are multi GB and our problem is restoring. We rather restore tables rather than the entire database in one go.l
Thanks for your kind words. Currently is not possible to use several files. I can only think about hacks, but none of them would be really useful. Best thing is to call mysqldump-php one for each table, but if you have another option in mind, just tell.
Regards,
Thanks for the update. I'll dig around over the next few days/weeks and see if I can come up with something and push it back.
That shouldn't be a big deal because you have include-tables option. Just run in for each table individually:
$user = 'user';
$pass = 'pass';
$dbname = 'test';
$dbhost = 'localhost';
$dbh = new PDO("mysql:host={$dbhost};dbname={$dbname}", $user, $pass);
foreach($dbh->query("SHOW TABLES IN `{$dbname}`") as $row) {
$table = current($row);
$dump = new IMysqldump\Mysqldump("mysql:host={$dbhost};dbname={$dbname}", $user, $pass, array("include-tables" => array($table)));
$dump->start("dumps/{$table}.sql");
}
Nice one. Thanks phpony. The simplest solutions are often the best. Works perfectly.
Hi, only came across this project today and am already loving and using it. Just wondering, is there an option to dump all tables in individual files rather than the entire database as one file? Our databases are multi GB and our problem is restoring. We rather restore tables rather than the entire database in one go.