dlebowski Posted January 5, 2012 Share Posted January 5, 2012 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); Quote Link to comment https://forums.phpfreaks.com/topic/254433-mysqldump-from-php-file-not-populating-with-data/ Share on other sites More sharing options...
litebearer Posted January 5, 2012 Share Posted January 5, 2012 Might look at #6 http://www.noupe.com/how-tos/10-ways-to-automatically-manually-backup-mysql-database.html Quote Link to comment https://forums.phpfreaks.com/topic/254433-mysqldump-from-php-file-not-populating-with-data/#findComment-1304576 Share on other sites More sharing options...
dlebowski Posted January 5, 2012 Author Share Posted January 5, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/254433-mysqldump-from-php-file-not-populating-with-data/#findComment-1304635 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.