Author Topic: Creating database backup problem!  (Read 6533 times)

0 Members and 1 Guest are viewing this topic.

Offline dbranko

  • Newbie
  • *
  • Posts: 20
    • View Profile
Creating database backup problem!
« 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:

Offline Acidgod

  • Moderator
  • 4images Guru
  • *****
  • Posts: 2.421
  • It's me?
    • View Profile
    • Flash-Webdesign
Re: Creating database backup problem!
« Reply #1 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...

Offline dbranko

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Creating database backup problem!
« Reply #2 on: February 06, 2007, 03:22:51 PM »
I dont understand what to do with that code?

Offline Acidgod

  • Moderator
  • 4images Guru
  • *****
  • Posts: 2.421
  • It's me?
    • View Profile
    • Flash-Webdesign
Re: Creating database backup problem!
« Reply #3 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:

Offline dbranko

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Creating database backup problem!
« Reply #4 on: February 09, 2007, 09:25:56 PM »
What is the name of that script?

Offline Acidgod

  • Moderator
  • 4images Guru
  • *****
  • Posts: 2.421
  • It's me?
    • View Profile
    • Flash-Webdesign
Re: Creating database backup problem!
« Reply #5 on: February 09, 2007, 09:29:07 PM »
xxxxxxxx.php or my_backup.php or what_else.php... (o: