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.
Related tutorial – MySQL
On this page, we offer quick access to a list of tutorials related to MySQL.
Tutorial MySQL – Copy a table to a new database
Access the MySQL command-line.
Access the MySQL database.
Describe the MySQL table.
Here is the command output:
Verify the MySQL table data.
Here is the command output:
Get the creation command of the source table
Here is the command output:
Take note of the command used to create the source table.
Access the destination database.
Create a copy of the MySQL table using the same configuration.
Copy the MySQL table data to the new table.
Verify the data on the destination table.
Here is the command output:
Verify the data on the source table.
Here is the command output:
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.