Would you like to learn how to copy a MySQL table to another database? In this tutorial, we are going to show you how to use the MySQL command-line to copy a table to a new database.

• Ubuntu 20.04
• Ubuntu 19.04
• Ubuntu 18.04
• MySQL 8.0.19

Equipment list

The following section presents the list of equipment used to create this tutorial.

As an Amazon Associate, I earn from qualifying purchases.

Tutorial MySQL - Copy a table to a new database

Access the MySQL command-line.

Copy to Clipboard

Access the MySQL database.

Copy to Clipboard

Describe the MySQL table.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

Verify the MySQL table data.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

Get the creation command of the source table

Copy to Clipboard

Here is the command output:

Copy to Clipboard

Take note of the command used to create the source table.

Access the destination database.

Copy to Clipboard

Create a copy of the MySQL table using the same configuration.

Copy to Clipboard

Copy the MySQL table data to the new table.

Copy to Clipboard

Verify the data on the destination table.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

Verify the data on the source table.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

In our example, we copied a table named USER to a new database.

Congratulations! You are able to copy a table using the MySQL command-line.