4images Forum & Community

4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started by: dbranko on February 06, 2007, 01:49:23 PM

Title: Creating database backup problem!
Post by: dbranko on February 06, 2007, 01:49:23 PM
When i try to make database backup,on finish backup,his size is 3,9MB and it is corupted! Hi is 8,2MB realy!Whats wrong!Sorry,bad english! :cry:
Title: Re: Creating database backup problem!
Post by: Acidgod on February 06, 2007, 02:02:19 PM
Code: [Select]
<?php

$host 
"XXXXXXXX";
$db "XXXXXXXX";
$dbuser "XXXXXXXX";
$dbpw "XXXXXXXX";

MYSQL_CONNECT($host$dbuser$dbpw) or die ( "<H3>Datenbankserver nicht erreichbar</H3>");
MYSQL_SELECT_DB($db) or die ( "<H3>Datenbank nicht vorhanden</H3>");

$path getenv('DOCUMENT_ROOT')."/DB_backup";
$result MYSQL_QUERY("SHOW TABLES");
$numrow MYSQL_NUM_ROWS($result);


for(
$i 0;$i $numrow;$i++) {
  
$date date("D");
  
$table MYSQL_RESULT($result,$i);
  echo 
"$date.$table ... ";
  
system(sprintf("mysqldump --opt -h $host -u $dbuser -p$dbpw $db $table | gzip > %s/$date.$table.sql.gz",$path));
  echo 
"DONE <br><br>";
}

MYSQL_CLOSE();

?>

You can use this PHP Script to make a Backup from the DB with a Cronjob... (o:

Try this...
Title: Re: Creating database backup problem!
Post by: dbranko on February 06, 2007, 03:22:51 PM
I dont understand what to do with that code?
Title: Re: Creating database backup problem!
Post by: Acidgod on February 09, 2007, 04:44:58 PM
Copy the Script into the root folder creat a folder "DB_backup" (chmod 777)...

Then call www.yourdomain.tdl/backup.php and after that take a look into the DB_backup folder... (o:
Title: Re: Creating database backup problem!
Post by: dbranko on February 09, 2007, 09:25:56 PM
What is the name of that script?
Title: Re: Creating database backup problem!
Post by: Acidgod on February 09, 2007, 09:29:07 PM
xxxxxxxx.php or my_backup.php or what_else.php... (o: