1.考虑使用truncate进行表格清空

  1. truncate table roles;
  2. truncate table settings;
  3. truncate table sg_car_applications;
  4. truncate table sg_car_attachments;
  5. truncate table sg_car_contacts;

2.使用mysqldump进行数据表导出

  1. mysqldump -uroot -pworld ycoa --tables sg_car_illegal_attachments sg_car_illegals sg_car_oil_cards sg_car_oil_statisticals sg_car_passengers sg_car_pay_statisticals sg_car_types sg_car_units sg_car_wait_locations sg_car_warranty sg_cars > ./ycoa_car_2.sql

3.修改外键名称(针对数据库已有名称相同的表格,进行外键修改)

直接使用gedit或者vim打开导出的sql文件,手动修改CONSTRAINT和KEY

4.使用mysql导入

  1. mysql -uroot -pworld table2 < ./table1.sql