Coder Social home page Coder Social logo

phpmybackup's Introduction

Note: This software has been superseded by a completely different server/client backup called MyBack.

MyBack does not require an open MySQL port to the backup sever, and is a far more robust & actively-maintained backup system.

Please consider using MyBack instead, as PHPMyBackup is no longer maintained.

https://github.com/axllent/myback


PHPMyBackup - A PHP MySQL differential backup script

A PHP MySQL differential backup script

PHPMyBackup is a PHP script designed for backing up an entire MySQL server on the commandline. What makes it unique is it only uses use differential methods to dump only the changes as it keeps a local copy of all the synced databases & tables.

Software features

  • Only download changed/altered tables (checksum)
  • Allows specifying subset of databases for backups (supports wildcard)
  • Allows skipping of specified databases from backups (supports wildcard)
  • Allows skipping of specified tables or table-data (supports wildcard)
  • Integrates with mysqldump client for individual SQL dumps
  • Backup rotation

Limitations

  • No database locking during backup. because a separate `mysqldump` is called for every table download, only table locking is used.
  • This has been tested in several environments, but your own full testing is always advised!

Requirements

  • A MySQL user on the server with ‘SELECT’ & ‘LOCK TABLES’ permissions
  • tar with xz support (used for compressing backups)
  • PHP CLI on backup host with MySQLi support
  • mysqldump (used for actual table dumping)

Usage Example

require('phpmybackup.php');
$db = new MYSQL_DUMP;
$db->dbhost = 'server.com';
$db->dbuser = 'backup-user';
$db->dbpwd = 'backup-password';
$db->backupsToKeep = 30;
$db->showDebug = false;
$db->backupDir = '/mnt/backups/mysql/';
$db->ignoreDatabases = ['test','unimportant_db'];
$db->emptyTables = ['largedb.large_table1','largedb.cachetable'];
$db->dumpDatabases();
  • The above command will dump all databases except for test and unimportant_db from server.com
  • The data from two tables, large_table1 & cachetable, (found in database largedb) will be ignored, however the table structure will be backed up. This is especially handy if you have temporary tables or large tables which contain unimportant / cached data.
  • A total of 30-days of backups will be kept. Note: Backups are named by date (yyyy-mm-dd.tar.xz), so a maximum of 1 backup per day can be kept. If the script is re-run on the same day, the repository is synced and the existing daily backup overwritten.

Notes

By default all databases are backed up ($db->includeDatabases = ['*']). You can limit this to a subset of your databases if you like.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.