472,779 Members | 1,806 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,779 software developers and data experts.

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 2118
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
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
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
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
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
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
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
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
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
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
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
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.