PHP code example of mnib-dev / mysqldump

1. Go to this page and download the library: Download mnib-dev/mysqldump library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mnib-dev / mysqldump example snippets


chdir(__DIR__);
$dump = new \MNIB\MysqlDump($dbname, $host, $port, $user, $password);

// Create dump
$dump->run([
    'mysqldump_bin' => '/usr/bin/mysqldump',
    'file' => __DIR__ . '/dump.sql',
    'archive' => __DIR__ . '/dump.sql.bz2',
    'archive_pattern' => '/usr/bin/pbzip2 --compress --best -c %1$s > %2$s',
    'defaults_extra_file' => __DIR__ . '/custom-my-file.cnf',
    'max_allowed_packet' => '512M',
    'dump_type' => null, // Valid options: null, "schema" or "data"
    'selected_tables' => [
        'product',
    ],
    'ignored_tables' => [
        'orders',
    ],
]);