Connecting Tech Pros Worldwide Forums | Help | Site Map

MySQL backup w/o dump?

Oliver Spiesshofer
Guest
 
Posts: n/a
#1: Jul 17 '05
Hi,

is there some free script that exports a whole database to a file similar
to mysqldump but without using mysqldump?
It should not be embedded too deeply into an application since I want to
include it into another open-source project without having to disassemble a
major other script such as phpMyAdmin.

thanks

Oliver


Michael Vilain
Guest
 
Posts: n/a
#2: Jul 17 '05

re: MySQL backup w/o dump?


In article <Xns959C915908EF4oliveremailcom@63.223.5.254>,
Oliver Spiesshofer <oliver@email.com> wrote:
[color=blue]
> is there some free script that exports a whole database to a file similar
> to mysqldump but without using mysqldump?
> It should not be embedded too deeply into an application since I want to
> include it into another open-source project without having to disassemble a
> major other script such as phpMyAdmin.[/color]

Don't see how you can do this with "it should not be embedded to deeply
into an application". The script, which you'll probably have to write
custom, must know of your tables and databases, extract the data
definition and the data itself, and write all this to a file. You're
essentially duplicating the effort of mysqldump.

Unless you can write such a script yourself, mysqldump is probably your
best bet. Why re-invent the wheel, unless you've got lots of time on
your hands?

cheap, fast, on-time. pick 2.

--
DeeDee, don't press that button! DeeDee! NO! Dee...



Eric Brongers
Guest
 
Posts: n/a
#3: Jul 17 '05

re: MySQL backup w/o dump?


Hi Oliver,

I use the folowing in a script:

Note: $ADMIN is the connection class to the MySQL database. I Build my own
CMS_class witch uses Pear to connect to a database. But I guess you
can read between the lines and use all the usefull stuff

Regards,
Eric
Freelance PHP Programmer.


function makedumpfile($table,$exkey="") {
global $ADMIN;
$query="select * from ".$table;
$result=$ADMIN->query($query);

if (is_file("../temp/".$table.".sql")) unlink ("../temp/".$table.".sql");

$fp=fopen("../temp/".$table.".sql","w");

fwrite($fp,"DELETE FROM ".$table."\r\n");
while ($Record=$result->fetchRow(DB_FETCHMODE_ASSOC)) {
//print_r($Record);
$velden="";
$waarden="";
foreach ($Record as $key=>$waarde) {
if ($exkey!=$key) {
$velden.=$key.",";
$waarden.="'".$waarde."',";
}
}
//for($j=0; $j<$localdb->numCols($result);$j++)
//$table_list .= mysql_field_name($result,$j).", ";
$velden=substr($velden,0,-1);
$waarden=substr($waarden,0,-1);
$dumptekst="INSERT INTO ".$table." (".$velden.") VALUES
(".str_replace("\r\n","",$waarden).")";
$dumptekst.="\r\n";
fwrite($fp,$dumptekst);
}
fclose($fp);


}


"Oliver Spiesshofer" <oliver@email.com> schreef in bericht
news:Xns959C915908EF4oliveremailcom@63.223.5.254.. .[color=blue]
> Hi,
>
> is there some free script that exports a whole database to a file similar
> to mysqldump but without using mysqldump?
> It should not be embedded too deeply into an application since I want to
> include it into another open-source project without having to disassemble[/color]
a[color=blue]
> major other script such as phpMyAdmin.
>
> thanks
>
> Oliver
>[/color]
"Oliver Spiesshofer" <oliver@email.com> schreef in bericht
news:Xns959C915908EF4oliveremailcom@63.223.5.254.. .[color=blue]
> Hi,
>
> is there some free script that exports a whole database to a file similar
> to mysqldump but without using mysqldump?
> It should not be embedded too deeply into an application since I want to
> include it into another open-source project without having to disassemble[/color]
a[color=blue]
> major other script such as phpMyAdmin.
>
> thanks
>
> Oliver
>[/color]


Oliver Spiesshofer
Guest
 
Posts: n/a
#4: Jul 17 '05

re: MySQL backup w/o dump?


"Michael Vilain <vilain@spamcop.net>" wrote in
news:vilain-DDEA35.09485209112004@news.giganews.com:
[color=blue]
> Don't see how you can do this with "it should not be embedded to
> deeply into an application". The script, which you'll probably have
> to write custom, must know of your tables and databases, extract the
> data definition and the data itself, and write all this to a file.[/color]

you misunderstood me. with "integrated" I meant that its a lot of work to
disasemble phpMyAdmin just to get a replacement of mysqldump. I know that
the script needs to be integrated into the software where I want to do it.
But I am searching for something which is easier to take out from where it
is than from phpMyAdmin.
[color=blue]
> You're essentially duplicating the effort of mysqldump.[/color]
exactly. just like phpMyAdmin did.
[color=blue]
> Unless you can write such a script yourself, mysqldump is probably
> your best bet. Why re-invent the wheel, unless you've got lots of
> time on your hands?[/color]

because this is supposed to become part of a open-source project which is
also directed at people who do not have access to mysqldump since their
provider does not allow it.

Oliver

Oliver Spiesshofer
Guest
 
Posts: n/a
#5: Jul 17 '05

re: MySQL backup w/o dump?


"Eric Brongers" <ebrongers@wanadoo.nl> wrote in
news:4191c1d4$0$25965$e4fe514c@news.xs4all.nl:
[color=blue]
> Hi Oliver,
>
> I use the folowing in a script:
>[/color]

thanks a lot! this is the first step.
Now I am missing "only" the one that is listing all tables and creates them
from scratch.

Oliver

Oliver Spiesshofer
Guest
 
Posts: n/a
#6: Jul 17 '05

re: MySQL backup w/o dump?


Oliver Spiesshofer <oliver@email.com> wrote in
news:Xns959EC129CD0FFoliveremailcom@63.223.5.246:
[color=blue]
> Now I am missing "only" the one that is listing all tables and creates
> them from scratch.[/color]

finally I found exactly the package I searched for at

http://freshmeat.net/projects/phpmysqlbackup/

Oliver

Closed Thread


Similar PHP bytes