Question : Query to Dump entire mySQL database?

Is it possible to dump a mySQL database with a query imbedded in a php or ColdFusion page?

In other words, create a link or page that dumps the entire database automatically to a file on the server or for download, without using phpMyAdmin or another mysql utility?

Answer : Query to Dump entire mySQL database?

You can run a system command from php.

The code will be something like this:

include 'config.php';
include 'opendb.php';

$backupFile = $dbname . date("Y-m-d-H-i-s") . '.gz';
$command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbname | gzip > $backupFile";
system($command);
include 'closedb.php';
?>

good luck

For more information you can read this tutorial: http://www.php-mysql-tutorial.com/perform-mysql-backup-php.php
Random Solutions  
 
programming4us programming4us