How to Copy MySQL Table from One Database to Another Database

Do you want to copy tables from one database to another in MySQL? If yes, this is the right blog for you. The need to copy tables from one database to another may appear in situations such as maintenance, testing, performance, migration, transfer to a different instance, and more. This is easy to do and can be done in many ways.

In this article, I’ll walk-through several ways to copy tables from one database to another in MySQL Server, helping you to see the benefits and trade-offs of each method. So, without wasting any more time, let’s start!

Method #1: Copy Table from one database to another in MySQL

Copying tables in a MySQL database to another MySQL database on the same server is quite easy. To copy data from a table to a new table, you can use CREATE TABLE and SELECT statements as follows:

First, create the table using the same engine and indexes as the original table:

CREATE TABLE dbtwo.mytable

LIKE dbone.mytable;

  • Next, copy all the records from the original table into the new table:

INSERT INTO dbtwo.mytable

SELECT *

FROM dbone.mytable;

  • You can also use the syntax:

CREATE TABLE table2 AS SELECT * FROM table1;

Note: To speed up inserts on the table with many records and keys, you can first disable the keys, then enable them:

ALTER TABLE dbtwo.mytable

DISABLE KEYS;

# do inserts here

ALTER TABLE dbtwo.mytable

ENABLE KEYS;

Keep in mind that the queries above only copy the table and its data. It does not copy other database objects such as index, primary key constraint, foreign key constraints, triggers, etc. associated with the table.

Method #2: Copy MySQL table from one database to another

You may go for the second method when the above methods fail to work properly. The queries mentioned above does not copy the database objects. Don’t worry! I have got a better solution for this. 

You should go for the professional software and one such tool is Aryson MySQL to MSSQL Converter. The tool offers a highly reliable solution to copies your MySQL tables with indexes and keys from one database to another within the same MySQL server.

It is a one-stop solution for copying tables from one database to another in MySQL server. The software has the proficiency to convert selected or significant Database objects such as tables into a specified database file format. I would recommend you to try the free demo version of this utility.

Steps to Copy MySQL Table from One Database to Another

Time needed: 5 minutes

A direct ways to copy MySQL Table from One to Another Database is Aryson Software.

  1. Install, and Run Software.

     First of all, launch “Aryson MySQL to MSSQL Converter” tool.

  2. Establish Server Connection.

    Select either Local Connection or Remote Connection.

  3. Select MySQL Server Database.

    Next, choose MySQL Server and click on Next.

  4. Choose MySQL Database and Destination Database.

    Select a database from MySQL then selects the database MySQL(destination database).

  5. Add Table of MySQL.

    Click on Add to add tables and click on Next to proceed further.

  6. Copy tables from one database to another in MySQL.

    Now, wait for the process to execute and hence the migration is successful.

Concluding Lines

I hope now you must have got a fair idea about how to copy tables from one database to another in MySQL. Two of the best methods are mentioned above but it is best to go with the MySQL to SQL Converter tool for migrating the tables with all its objects. For any such queries keep reading this column.

FAQ

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

There are two methods to copy data from one database table to another database in MySQL one is manual and another is third party application. Aryson MySQL to MSSQL Converter is one of the best third party tool that copy table database from one MySQL Server to another.

How do I export a table from one database to another database?

Using Aryson MySQL Converter software and choose MySQL database after that add the table and click on the OK button to copy data from one database into another in MySQL.

How can I copy data from one table to another table in the same database in MySQL?

Yes, with the help of Aryson MySQL Database Converter tool you can easily copy data from one MySQL database into another.

Can I copy MySQL data directory to another server?

Yes, you can using this software then you can easily copy database table of MySQL database to another. It also migrate database from MySQL to MS SQL Server.

3.7/5 - (3 votes)

About The Author:

I am a technical content writer at Aryson Technologies with an experience of 2 year specializing in writing about databases, data recovery, file management, e-mail recovery & migration solutions. Also, I am proficient in working in a challenging environment using all my skills and want to serve the reputed growth of the industry in the development field.

Realted Post

offer image

Aryson Technologies

united states

2880 Zanker Road, Suite 203, San Jose, CA - 95134, USA

india

A-58 , 2nd Floor A Block Sector 57, Noida, Uttar Pradesh 201301

© Copyrights 2014-2024 by Aryson Technologies Private Limited - All Rights Reserved