Page 1 of 1

tar corrupts my sql file

Posted: Fri Jul 11, 2008 8:08 pm
by php_ghost
I backed up my database using this code:

Code: Select all

       
exec("mysqldump --opt --host=$db_host --user=$db_user --password=$db_pass '$db_name' > $filename.sql");
exec("tar czvf $filename.tar.gz $filename.sql");
 
now I'm trying to restore my database by uploading the file and then run this code

Code: Select all

 
exec("tar -zxvf $filename", $file);
exec("mysql --verbose --user=$db_user --password=$db_pass $db_name < ".$db_name."-db-globackup.sql", $result, $response);
 
now my sql file is extracted successfully but the content has lots of special characters, words misspelled etc.

what could be the problem with my script?
TIA

Re: tar corrupts my sql file

Posted: Sat Jul 12, 2008 5:48 am
by Benjamin
Can you post an example of a before and after data result.