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 worked on a small sample DB (1MB), but
fails on my db (75MB)
Thanks :) 15 2346
..oO(Jerry Yang)
>I'm having issues with mysqldump
What issues?
Micha
On Sep 20, 8:20*pm, Jerry Yang <jexxt...@gmail.comwrote:
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 worked on a small sample DB (1MB), but
fails on my db (75MB)
Thanks :)
TinyMy or PHPMyAdmin.
On for failure on large databases - set_time_limit(0);
Jerry Yang wrote:
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 worked on a small sample DB (1MB), but
fails on my db (75MB)
Thanks :)
Without knowing what's wrong with mysqldump, no. That's normally the
best way to take a dump of the database. If that fails, chances are
other attempts will fail, also (depending on what's wrong, of course).
I recommend you fix mysqldump. See comp.databases.mysql.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attglobal.net
==================
Thanks for the replies.
My host is running mysql 5.0.51a and mysqldump does return any data.
I've quite a few references to this on google.. so I need to find a
way around it !!
This php works for small db's... but fails on my main db:
function write($contents) {
if ($GLOBALS['gzip']) {
gzwrite($GLOBALS['fp'], $contents);
} else {
fwrite($GLOBALS['fp'], $contents);
}
}
mysql_connect ($dbserver, $dbuser, $dbpass);
mysql_select_db($dbname);
if ($gzip) {
$fp = gzopen($file, "w");
} else {
$fp = fopen($file, "w");
}
$tables = mysql_query ("SHOW TABLES");
while ($i = mysql_fetch_array($tables)) {
$i = $i['Tables_in_'.$dbname];
if (!$silent) {
echo "Backing up table ".$i."\n";
}
// Create DB code
$create = mysql_fetch_array(mysql_query ("SHOW CREATE TABLE ".
$i));
write($create['Create Table'].";\n\n");
// DB Table content itself
$sql = mysql_query ("SELECT * FROM ".$i);
if (mysql_num_rows($sql)) {
while ($row = mysql_fetch_row($sql)) {
foreach ($row as $j =$k) {
$row[$j] = "'".mysql_escape_string($k)."'";
}
write("INSERT INTO $i VALUES(".implode(",", $row).");\n");
}
}
}
$gzip ? gzclose($fp) : fclose ($fp);
Any ideas ? Many Thanks
..oO(Jerry Yang)
>Thanks for the replies.
My host is running mysql 5.0.51a and mysqldump does return any data. I've quite a few references to this on google.. so I need to find a way around it !!
References to what? What's the problem with mysqldump? Please be more
specific.
Micha
Hi
This seems to explain the issue with mysqldump. http://bugs.mysql.com/bug.php?id=34192
Basically since my ISP has upgraded from 4.0.30 to 5.0.51a mysqldump
runs but does not produce any output. So I am having problems backing
up my database. My ISP has no plans to change the version of mysql at
the moment.
I tried the php script above and this works well on small databases,
it creates the output for large databases but they fail to restore.
I hope that makes sense..
Thanks
..oO(Jerry Yang)
>This seems to explain the issue with mysqldump. http://bugs.mysql.com/bug.php?id=34192
Basically since my ISP has upgraded from 4.0.30 to 5.0.51a mysqldump runs but does not produce any output.
Wouldn't this mean they only upgraded the client libraries, but not the
server? Why else would you have to use a 5.0 mysqldump on a 4.0 server?
Micha
On 22 Sep, 10:52, Michael Fesser <neti...@gmx.dewrote:
.oO(Jerry Yang)
This seems to explain the issue with mysqldump. http://bugs.mysql.com/bug.php?id=34192
Basically since my ISP has upgraded from 4.0.30 to 5.0.51a mysqldump
runs but does not produce any output.
Wouldn't this mean they only upgraded the client libraries, but not the
server? Why else would you have to use a 5.0 mysqldump on a 4.0 server?
Micha
They have upgraded all of the mysql, not just the mysqldump.
The mysqldump seems to run fine, but on output is given..
Help Please :)
Jerry Yang wrote:
On 22 Sep, 10:52, Michael Fesser <neti...@gmx.dewrote:
>.oO(Jerry Yang)
>>This seems to explain the issue with mysqldump. http://bugs.mysql.com/bug.php?id=34192 Basically since my ISP has upgraded from 4.0.30 to 5.0.51a mysqldump runs but does not produce any output.
Wouldn't this mean they only upgraded the client libraries, but not the server? Why else would you have to use a 5.0 mysqldump on a 4.0 server?
Micha
They have upgraded all of the mysql, not just the mysqldump.
The mysqldump seems to run fine, but on output is given..
Help Please :)
Get mysqldump fixed. But this isn't the correct newsgroup to be
following up on mysql questions.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attglobal.net
==================
Get mysqldump fixed. But this isn't the correct newsgroup to be
following up on mysql questions.
I agree this is the best solution.. but my ISP has no plans to do this
at the moment.
Any other ideas ?
Jerry Yang wrote:
On 22 Sep, 10:52, Michael Fesser <neti...@gmx.dewrote:
>.oO(Jerry Yang)
>>This seems to explain the issue with mysqldump. http://bugs.mysql.com/bug.php?id=34192 Basically since my ISP has upgraded from 4.0.30 to 5.0.51a mysqldump runs but does not produce any output.
Wouldn't this mean they only upgraded the client libraries, but not the server? Why else would you have to use a 5.0 mysqldump on a 4.0 server?
Micha
They have upgraded all of the mysql, not just the mysqldump.
The mysqldump seems to run fine, but on output is given..
Help Please :)
You say the script dumps the data but then it can't be restored... how
are you trying to restore it? Via a web interface or via command line?
Have you looked inside the dump file? Is it syntactically broken in any
way? i.e. has it been truncated?
IF your only way of backing up an restoring is via the web then you're
going to run into PHP upload and download limits eventually. PHP My
admin generally wont allow you to restore files bigger than 2Mb
compressed and there may be limits on script execution time that will
prevent a large backup or restore.
The best way round these problems, assuming you can't get your host to
fix the _actual_ problem would be to divide and conquer i.e. modify your
script to dump/restore a table at a time or 1000 records at a time so as
not to run into these walls.
Roger.
On Sep 22, 4:15 pm, r0g <aioe....@technicalbloke.comwrote:
Jerry Yang wrote:
On 22 Sep, 10:52, Michael Fesser <neti...@gmx.dewrote:
.oO(Jerry Yang)
>This seems to explain the issue with mysqldump. http://bugs.mysql.com/bug.php?id=34192 Basically since my ISP has upgraded from 4.0.30 to 5.0.51a mysqldump runs but does not produce any output.
Wouldn't this mean they only upgraded the client libraries, but not the
server? Why else would you have to use a 5.0 mysqldump on a 4.0 server?
Micha
They have upgraded all of the mysql, not just the mysqldump.
The mysqldump seems to run fine, but on output is given..
Help Please :)
You say the script dumps the data but then it can't be restored... how
are you trying to restore it? Via a web interface or via command line?
Have you looked inside the dump file? Is it syntactically broken in any
way? i.e. has it been truncated?
IF your only way of backing up an restoring is via the web then you're
going to run into PHP upload and download limits eventually. PHP My
admin generally wont allow you to restore files bigger than 2Mb
compressed and there may be limits on script execution time that will
prevent a large backup or restore.
The best way round these problems, assuming you can't get your host to
fix the _actual_ problem would be to divide and conquer i.e. modify your
script to dump/restore a table at a time or 1000 records at a time so as
not to run into these walls.
Roger.
Previously using mysqldump resulted in an sql file of approx 75MB, yet
the php script produced a file of 175MB !! using the same data.
I can't see anything wrong with the large file, but it's not right at
that size !!
I normally use BigDump to upload the sql backup and have found this
works well.
Any ideas ?
Jerry Yang wrote:
<snip>
>The best way round these problems, assuming you can't get your host to fix the _actual_ problem would be to divide and conquer i.e. modify your script to dump/restore a table at a time or 1000 records at a time so as not to run into these walls.
Roger.
Previously using mysqldump resulted in an sql file of approx 75MB, yet
the php script produced a file of 175MB !! using the same data.
I can't see anything wrong with the large file, but it's not right at
that size !!
Well not necessarily, it really depends on how many entries your dump
script is squeezing into each insert statement for example. There's many
ways of encoding the same data in SQL, some less efficient than others.
Have you got a local LAMP/WAMP setup? If so try loading it into a local
SQL DB. If it doesn't choke you're probably OK, but of course you should
take a look and check you have about the same number of records per
table as you have in your live DB etc.
Anyway, have a look at least, I'll keep my fingers crossed for you!
Roger.
Jerry Yang wrote:
>Get mysqldump fixed. But this isn't the correct newsgroup to be following up on mysql questions.
I agree this is the best solution.. but my ISP has no plans to do this
at the moment.
Any other ideas ?
Find another host. If they won't fix this, how many other problems will
you have that they won't fix?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attglobal.net
==================
..oO(Jerry Yang)
>On 22 Sep, 10:52, Michael Fesser <neti...@gmx.dewrote:
>.oO(Jerry Yang)
>This seems to explain the issue with mysqldump. http://bugs.mysql.com/bug.php?id=34192
>Basically since my ISP has upgraded from 4.0.30 to 5.0.51a mysqldump runs but does not produce any output.
Wouldn't this mean they only upgraded the client libraries, but not the server? Why else would you have to use a 5.0 mysqldump on a 4.0 server?
Micha
They have upgraded all of the mysql, not just the mysqldump.
OK, but then it can't be the bug you mentioned above.
>The mysqldump seems to run fine, but on output is given..
Help Please :)
Only your host can (and should!) fix this, because mysqldump is the
right and most flexible tool for this job.
Micha This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: James |
last post by:
HI,
I'm looking for a script that will allow users/admins to have a one
click backup solution for a MYSQL Database..
'BACK DATABASE' button, click and its done...
The a restore option, that...
|
by: Neil |
last post by:
Hi,
I hope this question isn't too far off topic....I'm almost at my wits
end trying to figure this out.
I have a Mysql database and I wish to automate the backup of the
database because I...
|
by: Konrad |
last post by:
I have an internet portal based on MySql database and what I need is
to make a database backup , after each actualization of data.
I know how should PHP code look like but I have no idea how to...
|
by: Duane Winner |
last post by:
Hello all -
I'm having a small problem with the mysql startup script that ships with
MySQL-3.23.56-1.
I'm running on RedHat Linux.
It works fine, but I have a backup server that runs a script...
|
by: John Smith |
last post by:
Hi
I am currently reviewing our backup procedures. Part of the issue has been
finding the right fit. There are obviously backup products that provide
mysql agents but unfortunately can not for...
|
by: Astra |
last post by:
Hi All
I understand that the basic principles to create a TCP/IP backup program for
a remote MySQL DB are:
a) Query/retrieve the schema.
b) Query/retrieve each table and create inserts...
|
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...
|
by: newman |
last post by:
Dear all,
I have mysql 4.1.11 on my current server, i need my database restore
another
server.. (another server mysql version is 4.1.11 same.)
And now... I just created new my database to new...
|
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...
|
by: Bootstrap Bill |
last post by:
I'm looking for a PHP program to backup and restore a mysql database.
I'm using Godaddy to host a forum. Their mysql control panel will only
restore a database of two megabytes or less. My...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 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...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: nia12 |
last post by:
Hi there,
I am very new to Access so apologies if any of this is obvious/not clear.
I am creating a data collection tool for health care employees to complete. It consists of a number of...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
|
by: GKJR |
last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
| | |