Back up MySQL file?
I am trying to create a small script that will backup a MySQL database. I can successfully create the backup file at the root of my Website using:
<?php // This PHP Script will backup the content of a MySQL database in a GZip file // Enter Database access details $host= 'HOSTNAME'; $user= 'USERNAME'; $pass= 'PASSWRD'; $db= 'DBNAME'; // Instructing the system to zip and store the database system(sprintf( 'mysqldump --opt -h%s -u%s -p%s %s | gzip > $s/dumpDB.sql.gz', $host, $user, $pass, $db, getenv('DOCUMENT_ROOT') )); echo '+DONE'; ?>
<?php // This PHP Script will backup the content of a MySQL database in a GZip file // Enter Database access details $host= 'HOSTNAME'; $user= 'USERNAME'; $pass= 'PASSWRD'; $db= 'DBNAME'; // FTP Server access details $ftphost= 'FTPHOSTHAME'; $ftpdir= 'FTPDIR'; $ftpuser= 'FTPUSERNAME'; $ftppass= 'FTPPASSWRD'; // Instructing the system to zip and store the database system(sprintf( 'mysqldump --opt -h%s -u%s -p%s %s | gzip > $s/dumpDB.sql.gz', $host, $user, $pass, $db, getenv('DOCUMENT_ROOT') )); echo '+DONE'; ?>
I've been searching for hours and can't find a solution that works. Any help will be much appreciated.
Many thanks,
T
-
mywebwork -
[ 1 ] Thanks
{{ DiscussionBoard.errors[575583].message }} -
-
Amsterdam -
Thanks
{{ DiscussionBoard.errors[575893].message }} -