Hello,
I'm trying to use mysqldump from php.
Here is the php im using for this:
$dbhost, $dbuser, $dbpass are present, but not show for security reasons.
PHP Code:
$path = "/home/a/c/acornmedia/public_html/tools/sqlmagic/backup/";
$backupFile = $dbname . date("Y-m-d-H-i-s") . '.gz';
$command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbname | gzip > $path . $backupFile";
system($command);
Is my actual mysqldump statement correct? I'm really new to linux. The dedicated server we rent uses ubuntu if that helps.
I'm not sure about the $path section, the person that commented on a different post wasn't clear whether this was the path to where the db should be moved to once gzipped, or where the db where it is dumped before its gzipped.
I basically want it to move the final .gz which contains the database dump to /home/a/c/acornmedia/public_html/tools/sqlmagic/backup/ which is the root path to the web area of the server.
However it doesn't work. No files get created in sqlmagic/backup/
Can anyone help?
Thanks