This is a php version of linux's mysqldump in terminal "$ mysqldump -u username -p...".
- PHP 5 >= 5.3.0
- PDO
<?php
use Ifsnop\Mysqldump as IMysqldump;
$dumpSettings = array(
'include-tables' => array('table1', 'table2'),
'exclude-tables' => array('table3', 'table4'),
'compress' => 'GZIP',
'no-data' => false,
'add-drop-database' => false,
'add-drop-table' => false,
'single-transaction' => true,
'lock-tables' => false,
'add-locks' => true,
'extended-insert' => true,
'disable-foreign-keys-check' => false,
'where' => '',
'no-create-info' => false
);
$dump = new IMysqldump\Mysqldump('clouddueling', 'root', 'password', 'localhost', 'mysql', $dumpSettings);
$dump->start('storage/work/dump.sql');
- include-tables
- Only include these tables.
- exclude-tables
- Exclude these tables.
- compress
- GZIP, BZIP2, NONE
- no-data
- add-drop-database
- add-drop-table
- single-transaction
- lock-tables
- add-locks
- extended-insert
- disable-foreign-keys-check
- where
- no-create-info
"ifsnop/mysqldump-php": "dev-master"
or
"ifsnop/mysqldump-php": "1.0.*"
- Write unit tests.
- Refactor into one class.
Format all code to PHP-FIG standards. http://www.php-fig.org/
This project is open-sourced software licensed under the MIT license
Originally based on James Elliott's script from 2009. http://code.google.com/p/db-mysqldump/