RE: [PHP] Re: MySQL back up

From: Date: Wed, 09 Oct 2002 12:40:34 +0000
Subject: RE: [PHP] Re: MySQL back up
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-119421@lists.php.net to get a copy of this message
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:admin@kabwebs.com] > Sent: Wednesday, October 09, 2002 7:25 AM > To: php-general@lists.php.net > 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

« previous php.general (#119421) next »