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...
If we want to copy tables or databases from one MySQL server to another, then use the mysqldump with database name and table name.
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With