MySQL efficiently copy all records from one table to another

前端 未结 4 1411
栀梦
栀梦 2021-01-01 15:47

Is there a more-efficent, less laborious way of copying all records from one table to another that doing this:

INSERT INTO product_backup SELECT * FROM produ         


        
4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-01 16:22

    mysqldump -R --add-drop-table db_name table_name > filepath/file_name.sql
    

    This will take a dump of specified tables with a drop option to delete the exisiting table when you import it. then do,

    mysql db_name < filepath/file_name.sql
    

提交回复
热议问题