PHP Classes

Danen MySQL Backup: Create database backup SQL statements using MySQLi

Recommend this page to a friend!
  Info   View files Example   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum (3)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 510 All time: 5,752 This week: 110Up
Version License PHP version Categories
danen-mysql-backup 2Freely Distributable5.4PHP 5, Databases, Systems administration


This class can create database backup SQL statements using MySQLi.

It can connect to a MySQL database table using the MySQLi extension and generates a file with SQL statements that can be used later to restore the table definition and record data of one or more database tables.

The class creates a backup file with a unique name and returns the backup file name.


Good backup/restore MySQL
Script to backup and restore databases

Picture of Gerry Danen
  Performance   Level  
Name: Gerry Danen <contact>
Classes: 3 packages by
Country: Australia Australia
Age: 73
All time rank: 219531 in Australia Australia
Week rank: 587 Up8 in Australia Australia Up


// example to do a full database backup

require_once 'danenMysqlBackup.class.php';

$B = new danenMysqlBackup();

$backupSqlFile = $B->backupStart();

if (
$backupSqlFile )
$backupSqlFile = basename( $backupSqlFile );
"Created: $backupSqlFile";
"ERROR: backup failed.";

  Files folder image Files  
File Role Description
Plain text file danenMysqlBackup.class.php Class Main class file
Accessible without login Plain text file doBackup.php Example Shows how to call the class
Accessible without login Plain text file readme.txt Doc. Some extra information

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:5,752
This week:110Up