1. Go to this page and download the library: Download phelium/mysql-backup 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/ */
$Dump = new MySQLBackup('localhost', 'root', '', 'blog');
$Dump->addTable('posts'); // Add the posts table
$Dump->addTables(array('users', 'comments')); // Add the users and comments tables
$Dump = new MySQLBackup('localhost', 'root', '', 'blog');
$Dump->excludeTables(array(comments')); // Exclude comments table to the backup
$Dump = new MySQLBackup('localhost', 'root', '', 'blog');
$Dump->setFilename('bkp_'.time());
$Dump = new MySQLBackup('localhost', 'root', '', 'blog');
$Dump->setDumpStructure(false); // Not the structure
$Dump->setDumpDatas(false); // Not the datas
$Dump = new MySQLBackup('localhost', 'root', '', 'blog');
$Dump->addCreateDatabaseIfNotExists(false); // Not add the CREATE DATABASE IF NOT EXISTS statment
$Dump = new MySQLBackup('localhost', 'root', '', 'blog');
$Dump->addDropTable(false); // Not add the DROP TABLE IF EXISTS statment
$Dump = new MySQLBackup('localhost', 'root', '', 'blog');
$Dump->addIfNotExists(false); // Not add the IF NOT EXISTS statment
$Dump = new MySQLBackup('localhost', 'root', '', 'blog');
$Dump->setCompress('zip'); // zip | gz | gzip
$Dump = new MySQLBackup('localhost', 'root', '', 'blog');
$Dump->setDelete(true);