Click here to Skip to main content
15,898,957 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Greetings,

i want to include a location on where my backup database will be created, but when i include a path on where the backup database will be created in my code, the code doesn't working and there is no database file being created to the specified location. but when i remove the path, the code works properly can please you please help me on this, cause i need this to complete my admin module, and i want all the backup data to be created in one single folder. here's my code
$dbhost = 'localhost';
$dbuser = 'username';
$dbpass = 'password';
$dbname = 'databasename';
			
			   
$path = 'home2/tintinba/public_html/test/admin/backup/';
			   
$backupFile = $path . $dbname . date("Y-m-d-H-i-s") . '.gz';
$command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbname | gzip > $backupFile";

system($command);

hope you guys can help me on this, thank you..
Posted
Updated 29-May-11 23:01pm
v3
Comments
ZeeroC00l 30-May-11 5:02am    
-- added pre tag

1 solution

You have to change

mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbname | gzip > $backupFile


to

mysqldump --opt -h $dbhost -u $dbuser -p$dbpass $dbname | gzip > $backupFile


You have a "space" between -p and $dbpass.

http://dev.mysql.com/doc/refman/5.5/en/mysqldump.html#option_mysqldump_password[^]
 
Share this answer
 
Comments
[no name] 30-May-11 21:37pm    
thanks again Kim Togo, you always help me when i having trouble with my code.. hope to have more discussion with you, thanks again ^^
Kim Togo 31-May-11 2:26am    
You are welcome :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900