Jump to content

mysqldump from php file not populating with data


dlebowski

Recommended Posts

Any help on this would be greatly appreciated.  I am trying to run a mysqldump from my site for my client when they want to back up.  They basically will jsut click a button to run the backup. 

 

With my script below, the backup file is genrated, but there is no table data in the file.  There are the headers in the file with the server IP, linux versin, etc..., but there is no data in the file.  Does this look right?  Thank you for helping me out.

 

Ryan

 

ini_set ("display_errors", "1");
error_reporting(E_ALL);

$dbhost = 'localhost';
$dbuser = 'databaseuser';
$dbpass = 'password';

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die                      ('Error connecting to mysql');

$dbname = 'database';
mysql_select_db($dbname);

$tableName  = 'lots';
$backupFile1 = '/home/stuff/wwwroot/stuff/appnew/backup/';
$backupFile = $backupFile1.$dbname . date("Y-m-d-H-i-s") . '.gz';
$command = "mysqldump --opt -h$dbhost -u$dbuser -p$dbpass $dbname | gzip > $backupFile";
system($command);
$result = mysql_query($command);

I need to take this a step further.  I can actually get it to run using mysqldump, but my DB server is independent of my web server.  I need this file that is created on my DB server in "/home/stuff/wwwroot/stuff/appnew/backup/" to actually be put in a directory on my web server.  How would I do that? 

 

Thank you for the reply.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.