ifsnop / mysqldump-php

PHP version of mysqldump cli that comes with MySQL
https://github.com/ifsnop/mysqldump-php
GNU General Public License v3.0
1.25k stars 300 forks source link

export only one table from database? #219

Open bag7dad opened 3 years ago

bag7dad commented 3 years ago

I am thinking about limit all other tables

//export table4

use Ifsnop\Mysqldump as IMysqldump;

try {
    $dump = new IMysqldump\Mysqldump('mysql:host=localhost;dbname=aaaa', 'bbbb', 'cccc');
    $dump->setTableLimits(array(
    'table1' => 0,
    'table2' => 0,
    'table3' => 0,
));
    $dump->start('file/dump.sql');
} catch (\Exception $e) {
    echo 'mysqldump-php error: ' . $e->getMessage();
}

is that correct?

garas commented 3 years ago

Try 'include-tables' => array() option.

https://github.com/ifsnop/mysqldump-php#dump-settings