Skip navigation links

MySQL Forums :: Newbie :: copying data from a local machine to a remote machine


Advanced Search

copying data from a local machine to a remote machine
Posted by: Jean-Michel Andre ()
Date: November 06, 2009 11:26AM

I have to copy data from a Mysql database DB1 on one machine, M1, to a table in a Mysql database DB2 on a remote machine, M2. Both tables are MyISAM tables.

A basic "INSERT INTO SELECT" does not seem to work in this case since it works only if tables are on the same machine (or do I miss something ?)

Maybe the Federated engine can help in this case but I would prefer to stay with the engines I used to work with, i.e. MyISAM or Innodb.

I wonder if I could use a temporary table, say my_temp, in 2 steps :
1) Populate my_temp using a connection to DB1 on M1
2) Insert data from my_temp into the remote table, using another connection to DB2 on M2.

I've tried to do that in a PHP script. The first step is OK.
For the 2nd step, MySQL returns an error saying that table db2.my_temp does not exist, db2 being the default DB for my connection to M2.

Is there a way to use this temporary table (created by a connection to M1) in a query using another connection to M2 ? Or is it just impossible ? In that case, what is the best way to do such a copy ?

Options: ReplyQuote


Subject Written By Posted
copying data from a local machine to a remote machine Jean-Michel Andre 11/06/2009 11:26AM
Re: copying data from a local machine to a remote machine Rick James 11/07/2009 04:06PM
Re: copying data from a local machine to a remote machine Jean-Michel Andre 11/09/2009 07:28AM


Sorry, only registered users may post in this forum.