Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy a mysql table content from one server to another server

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...

like image 879
Ranjith Avatar asked May 09 '12 11:05

Ranjith


People also ask

How do I copy data from one MySQL server to another?

If we want to copy tables or databases from one MySQL server to another, then use the mysqldump with database name and table name.

How do I copy a table data from one server to another in SQL Server?

Enter the data source, server name and select the authentication method and the source database. Click on Next. Now, enter the destination, server name, authentication method and destination database then click on Next. Select 'Copy data from one or more tables or views' option in the next window and click on Next.

How do I copy a table data from one database to another database?

Using SQL Server Management StudioOpen the table with columns you want to copy and the one you want to copy into by right-clicking the tables, and then clicking Design. Click the tab for the table with the columns you want to copy and select those columns. From the Edit menu, click Copy.


1 Answers

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
like image 161
aleroot Avatar answered Sep 30 '22 11:09

aleroot