468,315 Members | 1,351 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,315 developers. It's quick & easy.

MySQL backup w/o dump?

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

Jul 17 '05 #1
5 1940
In article <Xn****************************@63.223.5.254>,
Oliver Spiesshofer <ol****@email.com> wrote:
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.


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...

Jul 17 '05 #2
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" <ol****@email.com> schreef in bericht
news:Xn****************************@63.223.5.254.. .
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
"Oliver Spiesshofer" <ol****@email.com> schreef in bericht
news:Xn****************************@63.223.5.254.. . 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

Jul 17 '05 #3
"Michael Vilain <vi****@spamcop.net>" wrote in
news:vi**************************@news.giganews.co m:
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 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.
You're essentially duplicating the effort of mysqldump. exactly. just like phpMyAdmin did.
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?


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

Jul 17 '05 #4
"Eric Brongers" <eb*******@wanadoo.nl> wrote in
news:41***********************@news.xs4all.nl:
Hi Oliver,

I use the folowing in a script:


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

Jul 17 '05 #5
Oliver Spiesshofer <ol****@email.com> wrote in
news:Xn****************************@63.223.5.246:
Now I am missing "only" the one that is listing all tables and creates
them from scratch.


finally I found exactly the package I searched for at

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

Oliver

Jul 17 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Dave Moore | last post: by
6 posts views Thread by Mosher | last post: by
2 posts views Thread by Laphan | last post: by
4 posts views Thread by news | last post: by
1 post views Thread by alex | last post: by
6 posts views Thread by frank78 | last post: by
4 posts views Thread by Robert Blackwell | last post: by
5 posts views Thread by linuxlover992000 | last post: by
15 posts views Thread by Jerry Yang | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.