I agree everything, but Im not very sure if this is going to work: -------- > $backup=@passthru("mysqldump --opt \"$sqldatabase\" > -------- > $backupdir/$nam.sql");
-------- You need to send mysqldump the username and password. Syntax is -------- Mysqldump -uuser -ppassword databasename > filename.sql Y think tou should use: Mysqldump -u user --password user_password > filename.sql I had an expirience with perl trying like John "mysqldump -uuser -ppassword databasename > filename.sql" did not work, i think you have to send the password too. Regards. Daniel > -----Original Message----- > From: Ken [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, October 09, 2002 7:25 AM > To: [EMAIL PROTECTED] > Subject: [PHP] Re: MySQL back up > > Here is the code I tired to use: > > <?php > > session_start(); You don't need to start a session... > require("./config.php"); > > $sqlserver = $server1; > > $sqlusername = $username1; > > $sqlpassword = $password1; > > $sqldatabase = $database1; > > $nam=date('D,d-m-Y'); > > @ $db = mysql_pconnect($sqlserver, $sqlusername, $sqlpassword); You don't need to connect to the mysql server. > > if (!$db) > > { > > echo "Could not connect to MySQL"; > > exit; > > } > > $backup=@passthru("mysqldump --opt \"$sqldatabase\" > > $backupdir/$nam.sql"); You need to send mysqldump the username and password. Syntax is Mysqldump -uuser -ppassword databasename > filename.sql > passthru("gzip $backupdir/$nam.sql"); Why are you using passthru? Neither of these commands should return any output, so passthru isn't returning anything. You can use backticks or exec() instead. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php