I’ve recently switched over to Dreamhost (two days ago), and am working on making all of my scripts work on the new server. This one was written for me so I don’t understand it perfectly, this is just a snippet. BACKUPDIR is defined earlier as where I would like the backup to go. Now I’ve tried specifying the host, and I’ve tried saying a specific database instead of just the catch all databases, but that didn’t work either. Let’s assume I always want to back up all the databases, and all the tables therein. What do I do?
[php] // do we want to back up all databases?
$backupall = ($_POST[‘backupall’] == ‘false’) ? false : true;
// if we want to back up all databases, set this to -A in the command (backs up all), if not, set it to the name of the database to back up $dbarg = $backupall ? '-A' : $_POST['backupwhichdb']; // form our command to execute $command = "mysqldump ".$dbarg." -u ".$_POST['mysqluser']." -p".$_POST['mysqlpass']." -r \"".BACKUPDIR.$_POST['filename']."\" 2>&1";
This is the current version I am working on:
$command = “mysqldump -h mysql.absurdity981.com -u “.$_POST[‘mysqluser’].” -p”.$_POST[‘mysqlpass’]." -B absurdity981_sitemap “”.BACKUPDIR.$_POST[‘filename’]."" 2>&1";
It displays all the database info in the page, instead of sending it to a new page. As well I get the error:
mysqldump: Got error: 1102: Incorrect database name ‘/home/kochier/www/absurdity981.com/library/22Mar2013_23.11.47.sql’ when selecting the database at the bottom of the page.
EDIT: Also if I use -A it’ll display a list of options "Usage: mysqldump [OPTIONS] database [tables] OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3…] OR mysqldump [OPTIONS] --all-databases [OPTIONS] For more options, use mysqldump --help " that I’m not sure how to utilize.