Git Product home page Git Product logo

mysqldump-php's Introduction

MySQLDump - PHP

This is a php version of linux's mysqldump in terminal "$ mysqldump -u username -p...".

Requirements

PHP 5 >= 5.1.0, PECL pdo >= 0.2.0

Installation

Install mysqldump using artisan:

php artisan bundle:install mysqldump

Then in your application/bundles.php file, add the following line to load Resizer automatically:

return array(
    'mysqldump' => array( 'auto' => true )
);

Or without the 'auto' => true to load it on demand:

return array(
    'mysqldump'
);

Base usage

<?php

$dump = new MySQLDump('forum','forum_user','forum_pass','localhost');
$dump->start('forum_dump.sql');
$dump->start('forum_anotherdump.sql');    

Advanced usage

<?php

class Cron_Controller extends Base_Controller
{
    public function get_backup()
    {
        Bundle::start('mysqldump');
        $conn = Config::get('database.connections.mysql');

        $filename = time() . ".sql";
        $filepath = "storage/work/";

        $dump = new MySQLDump();
        $dump->host     = $conn['host'];
        $dump->user     = $conn['username'];
        $dump->pass     = $conn['password'];
        $dump->db       = $conn['database'];
        $dump->filename = $filepath . $filename;
        $dump->start();

        return "Backup complete.";
    }
}

Credits

This was originally written by James Elliott in 2009, I OOP'd it up, outputted to file, simplified the process, fixed some mysql errors, and updated it to PSR standards.

Original site: http://code.google.com/p/db-mysqldump/

Enjoy.

mysqldump-php's People

Contributors

clouddueling avatar maikeldaloo avatar

Watchers

James Cloos avatar Tirapong Chaiyakun avatar

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.