PHP Classes
elePHPant
Icontem

PHP Backup MySQL Database Automatically: Backup and restore MySQL database dumping SQL file

Recommend this page to a friend!
  Info   View files Documentation   View files View files (18)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2019-10-10 (1 month ago) RSS 2.0 feedNot yet rated by the usersTotal: 191 This week: 4All time: 8,328 This week: 79Up
Version License PHP version Categories
db-backup-restore 1.0.0Custom (specified...5PHP 5, Databases, Systems administration
Description Author

This class can backup and restore MySQL database dumping SQL file.

It takes the name of a given MySQL database and connects to a database server using MySQLi. Then it generates a file with SQL statements that can be used later to recreate the database SQL statements in case the it is necessary.

The class can also read a file previously generated by this class, so it can restore the tables and records of a MySQL database that was run the backup process described above.

Recommendations

MySQL Database Backup/Restore scripts
I want PHP scripts to backup and restore MySQL database on a Mac

  Performance   Level  
Name: Zacchaeus Bolaji <contact>
Classes: 6 packages by
Country: Nigeria Nigeria
Innovation award
Innovation award
Nominee: 1x

 

Details

DB BackUp and Restore Class

Issues and pull requests welcome.

A PHP Class that helps take backup of DB as well as restore from backup.

Table of Contents

Installation

You will need PHP 7.x and composer.

Install using composer: composer require djunehor/db-backup-restore

Usage

use \Djunehor\DB\BackUp;

/
	 *
	 *
	 * @param string $host
	 * @param string $username
	 * @param string $password
	 * @param string $database
	 * @param string $charset
	 * @param string $lang
	 */
$db = new BackUp( 'localhost', 'root', '', 'test', 'utf8', 'en' );

// To backup DB
$db->backup ();

//To restore from backup
$db->restore ( __DIR__.'/backup/20121027194215_all_v1.sql')

Acknowledgment

Adapted from the class created by yanue

Contribute

Check out the issues on GitHub and/or make a pull request to contribute!

  Files folder image Files  
File Role Description
Files folder image.circleci (1 file)
Files folder imagebuild (1 file)
Files folder imagesrc (1 file, 1 directory)
Accessible without login Plain text file .editorconfig Data Auxiliary data
Accessible without login Plain text file .scrutinizer.yml Data Auxiliary data
Accessible without login Plain text file .styleci.yml Data Auxiliary data
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file CHANGELOG.md Data Auxiliary data
Accessible without login Plain text file CODE_OF_CONDUCT.md Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file CONTRIBUTING.md Data Auxiliary data
Accessible without login Plain text file ISSUE_TEMPLATE.md Data Auxiliary data
Accessible without login Plain text file LICENSE.md Lic. License text
Accessible without login Plain text file phpcs.xml.dist Data Auxiliary data
Accessible without login Plain text file phpunit.xml.dist Data Auxiliary data
Accessible without login Plain text file PULL_REQUEST_TEMPLATE.md Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  .circleci  
File Role Description
  Accessible without login Plain text file config.yml Data Auxiliary data

  Files folder image Files  /  build  
File Role Description
  Accessible without login Plain text file report.junit.xml Data Auxiliary data

  Files folder image Files  /  src  
File Role Description
Files folder imagelang (1 directory)
  Plain text file BackUp.php Class Class source

  Files folder image Files  /  src  /  lang  
File Role Description
Files folder imageen (1 file)

  Files folder image Files  /  src  /  lang  /  en  
File Role Description
  Accessible without login Plain text file messages.php Aux. Auxiliary script

 Version Control Unique User Downloads Download Rankings  
 100%
Total:191
This week:4
All time:8,328
This week:79Up