Duplicating a MySQL table, indices, and data
Asked 07 September, 2021
Viewed 755 times
  • 64
Votes

How do I copy or clone or duplicate the data, structure, and indices of a MySQL table to a new one?

This is what I've found so far.

This will copy the data and the structure, but not the indices:

create table {new_table} select * from {old_table};

This will copy the structure and indices, but not the data:

create table {new_table} like {old_table};

14 Answer