Mohiyo Deen Mohiyo Deen - 1 year ago 49
MySQL Question

How to backup MySQL database using Query?

How can we backup MySQL database using Query, like we can backup MS-SQL using following Query.


backup database DATABASENAME to disk = 'PATH'

Answer Source

Use mysqldump-php a pure-PHP solution to replicate the function of the mysqldump

    $dumpSettings = array(
        'include-tables' => array('table1', 'table2'),
        'exclude-tables' => array('table3', 'table4'),
        'compress' => CompressMethod::GZIP, /* CompressMethod::[GZIP, BZIP2, NONE] */
        'no-data' => false,            
        'add-drop-table' => false,      
        'single-transaction' => true,   
        'lock-tables' => false,        
        'add-locks' => true,            
        'extended-insert' => true      

    $dump = new MySQLDump('database','database_user','database_pass','localhost', $dumpSettings);

also visit this link GitHub