473,499 Members | 1,494 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2162
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2559
by: Dave Moore | last post by:
Hi All, I'm looking at using PHP and MySQL for a particular website application. However, I was a bit concerned that if a PHP script went wrong then it would be possible to accidentally delete or...
6
1788
by: Mosher | last post by:
Hi all, I am wanting to automatically do dump of a mysql database nightly using cron and some kind of script that will email the whole db structure to me (as an attachment or as plain text in my...
2
2506
by: Laphan | last post by:
Hi All Has anybody got any pointers or examples on how I can create a VB app to connect to a remote MySQL server at a set time and backup a remote db to local file? Although a lot of the...
1
4020
by: Dave Crypto | last post by:
Hi there, SUMMARY: 1) When I use phpadmin to export a large database, the file created on my local PC never containes all the tables and information. It seems to max out at about 10mb. 2)...
4
12676
by: news | last post by:
Our production database in an exported textfil runs about 60 MB. Compressed that's about 9 MB. I'm trying to import the export into another machine running FC3 and mySQL 11.18, and it appears as...
1
4721
by: alex | last post by:
Hi ! I couldn't make backups with our new system using db2 8.2. Every time I trigger a backup I get this error message: BACKUP DATABASE EBUERO2 ONLINE TO "/raid/backup/ebuero2/part1",...
6
1726
by: frank78 | last post by:
Hi everyone, I am having a little bit of trouble backing up some mySQL tables. I've been trying to adapt a script I found on the internet at...
4
3681
by: Robert Blackwell | last post by:
A while ago I had some help from here to make a batch file that would dump my db. Everything was working just fine until 2 days ago and I just found out. I checked my backup folder and found...
5
15384
by: linuxlover992000 | last post by:
I am a newbie in the world of MySQL. In fact I enabled it in my Linux box only because it is required to run WordPress (the blogging software). I was trying to plan ahead and figure out a way to...
15
2368
by: Jerry Yang | last post by:
Hi I'm having issues with mysqldump so need to create backups of my mysql databases using PHP. Can any one recommend a way to do this with out calling mysqldump ? I did find one script and it...
0
7130
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7007
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7171
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7220
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7386
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4599
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3098
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3090
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
295
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.