MySQL表的导入

mysql> truncate actor;
ERROR 1701 (42000): Cannot truncate a table referenced in a foreign key constraint (`sakila`.`film_actor`, CONSTRAINT `fk_film_actor_actor`)

若一个table 中的某个column是其他table的foreign key,那么,该table不能使用truncate\drop。

解决方法:https://www.cnblogs.com/hankyoon/p/5169615.html

 

 

如果不希望加载文件中的前100行,如下: 

load data infile '/data/actor.txt' into table actor fields terminated by ',' ignore 100 lines;

 

 

也可以使用mysqlimport 导入。

posted @ 2020-08-21 15:57  别看窗外的世界  阅读(181)  评论(0编辑  收藏  举报