How to Copy a MySQL Table with phpMyAdmin

February 12, 2021 / MySQL

The article would help you with a step-by-step procedure about how to copy a table with phpMyAdmin located within the cPanel control panel.

Follow the Steps: 

  1. Log into cPanel.
  2. Go to phpMyAdmin and choose the database and the table that you intend to copy
    list of databases
  3. Go to the option titled “Operations” listed amongst the other tabs
    Operations
  4. Locate the box titled “Copy table to (database,table): ”
  5. There are two options you may choose from ie. either create a copy of the table to the current database (usually gets selected by default) OR copy the table to a different database
  6. Choose the database name from the drop-box and the name of the table to copy the structure and / or data into.
    You are required to choose between the following options before proceeding any further :
    Structure only – Selecting this option would only create a copy of the table and its name. You must note that the data wouldn’t be copied in this case.
    Structure and data – Choosing this option would allow you to copy the table along-with its name, but would also copy the data it contains to the destination you choose further in the process ie. INSERT INTO >> SELECT * FROM …
    Data only – Clicking the radio button would only copy the data to the destination.Copy MySQL table phpMyAdmin
  7. Furthermore, you are offered the option to choose whether you wish to drop the table that you are copying before creating the table and copying the data.
  8. This runs a DROP TABLE IF EXISTS query for the copy of the table, not the original. You would not notice any change if you’ve chosen data only copy.
  9. Then you’d have the option to choose to copy the auto increment value. This isn’t a default function, and you’d need to check it manually.
  10. The auto increment value will end up being whatever it would be after the INSERT INTO query is done. Checking the box would activate the CREATE TABLE syntax which would then include the auto increment value from the original table.
  11. Lastly, you can see the option termed “Switch to copied table ”, as the title suggests you’d be switched over to the copied table once the queries are completed.

If you leave it unchecked, the resulting page will still be looking at the original table; if checked it will change to the copied database (if applicable) and table.

To Sum up, Understanding MySQL is important. If you’re interested in creating tables, Check out our guide on How to Create Tables in cPanel Using phpMyAdmin

Spread the love