View Single Post
  #1 (permalink)  
Old 30-09-2007, 06:16
viewnepal viewnepal is offline
new member
 
Join Date: Sep 2007
Posts: 1
Default mysqldump command creat only empty files?

I want to backup my MySQL Server Database so for that i have try to put my following code in cron job as well in php file. i am able to create the file but file is 0kb. why it is happening. for your convenience the code is as followes.

code that i have used in cron job is this.

mysqldump -hlocalhost -uusername -ppassword dbname > /home/user/public_html/myfolder/mysql_backup.sql

this codes creat a file mysql_backup.sql but it is empty. please help me.

similarly the code i have try in php file is using exec command.

$file = "backup-".date("m-d-y-H-i-s");
@exec("mysqldump -h localhost -u username -ppassword dbname ¦ gzip > /home/user/public_html/myfolder/$file.txt.gz");

Similary this code is also work to create the gip file but here also this is empty.

Please help me how i can be able this. i need to do it in php and MySQL Server normally.
Reply With Quote