PHP MySQL Database Backup is a very simple and clean class for creating backup from MySQL databases.
require_once 'phpmysqlbackup.class.php';
$phpmysqlbackup = new PHPMySQLBackup('localhost', 'root', '', 'database');
$phpmysqlbackup->backup();
- Custom backup file name
$phpmysqlbackup->file = 'custom-file-name.sql';
- GZip compression
$phpmysqlbackup->compress = true;
- Add
DROP TABLE IF EXISTS
query beforeCREATE TABLE
$phpmysqlbackup->drop_if_exists = true;
- Custom table to backup
$phpmysqlbackup->tables = array('table_1', 'table_2');
- Backup file path
$phpmysqlbackup->path = 'backup-dir/';