Copy a mysql table content from one server to another server

Ranjith picture Ranjith · May 9, 2012 · Viewed 11k times · Source

How to copy a table from server A database db1 to server B database db2 ?

I am able to copy a table from one database to another database within the server, but not able to do for across servers.

CREATE TABLE recipes_new LIKE production.recipes; 
INSERT recipes_new SELECT * FROM production.recipes;

The whole thing I am doing it to reduce the server load so that I can copy table info into another server and run my queries there...

Answer

aleroot picture aleroot · May 9, 2012

You can dump the table with mysqldump and import the dumped file in the other Server :

mysqldump - root -p db1 tabletoexp > table.sql

and on the other side :

mysql -u root -p db2 < table.sql