Duplicating a MySQL table, indices, and data

前端 未结 12 1189
天涯浪人
天涯浪人 2020-11-27 08:42

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

12条回答
  •  有刺的猬
    2020-11-27 09:32

    After I tried the solution above, I come up with my own way.

    My solution a little manual and needs DBMS.

    First, export the data.

    Second, open the export data.

    Third, replace old table name with new table name.

    Fourth, change all the trigger name in the data (I use MySQL and it show error when I don't change trigger name).

    Fifth, import your edited SQL data to the database.

提交回复
热议问题