Shashank
Shashank

Reputation: 782

Export data of one mysql table (server A) to another mysql table (server 2)

How can export "partial data" of one mysql table (on server A) to another mysql table (on server B)? My limitations are :

Please note table structure is same but database name is different.

Upvotes: 0

Views: 45

Answers (1)

e4c5
e4c5

Reputation: 53774

It will have to be a two step operation. On server 1, you use SELECT INTO OUTFILE

SELECT *  INTO OUTFILE '/var/lib/mysql/files/badatxt' FROM m_table WHERE some_condition;

Then after copying the file to the second server, you do a LOAD DATA INFILE

LOAD DATA INFILE '/var/lib/mysql/files/badatxt' INTO m_table;

Alternatively if the local file settings are enabled (see doc for details) you can do a LOAD DATA LOCAL INFILE

Upvotes: 1

Related Questions