Losing connection to MySQL when copying data from one MySQL server to another

Hello,

I am copying data from one MySQL server to another, when the number of records are under 30,000
the copying is done OK. But if the number of records goes over 30,000, the copying fails with this
error message:

Lost connection to MySQL server during query

How can I correct this so that any number of records can be copied from one MySQL server to another of ours?

Regards,

i would dump the table(s) into .sql files, then run the .sql files into the target server

Hi,

1st, isnt there anything I can do to keep the current program but just enable large number of rows being
INSERT from one MySQL server to another?
So again currently about 20,000 row INSERTs works Ok, but after that on this new server (2) the INSERT
fails with the Error message I provided.

2nd, if somehow there is NO way to INSERT more than 20,00 rows from MySQL server2 to server2 and one
has to do it via method you suggested, how can this be programmed in Php?
I mean what are the Php/MySQL commands for copying a Table into a file and then uploading that SQL
file into another server?

Regards,

sorry, i don’t do php

you need to invoke the mysqldump command

Nah, mysqldump will not do it for this purpose, since I need to initiate these transfer of MySQL data from server1 to server2 via a
Web based interface.

But I have found a round about solution to move 20,000 rows at a time via the Insert command. And for now it seems do the job.

ThanX anyway.

You can get a dump of the data via PHPMyAdmin, it gives you a number of options for what format you want the dump to be in.

all phpmyadmin does is run mysqldump “under the covers”

but as worldnews says, “thanx anyway” :smiley:

Phpmyadmin normally kneel on larger databases, but even if you dont have shell access you can do a mysql dump from php.

The key is to write the mysqldump command like this: exec(‘mysqldump -uUser -pPassword database > file.sql’);

I.e. no space after the variable to set the user or password. You can also as normally add other commands as well to the mysqldump if desired.