我们有一个包含数千条记录的 CSV 文件。我想通过 phpmyadmin 将这些行导入 MySQL 表。这是使用的命令:
load data local infile '/var/www/html/deansgrads_201280.csv'
into table ttu_nameslist
fields terminated by ','
enclosed by '"'
lines terminated by '\r\n'
(firstname, middlename, lastname, city, county, state, termcode, category)
表中有一个 ID 字段设置为自动递增。当我们执行这个 SQL 时,只有第一行被导入到表中。
输入数据文件行:
"Aaron","Al","Brockery","Cookeville","Putnam","TN","201280","deanslist"
"Aaron","Dan","Mickel","Lebanon","Wilson","TN","201280","deanslist"
表结构:
CREATE TABLE `ttu_nameslist` (
`id` int(11) NOT NULL,
`firstname` varchar(50) NOT NULL,
`middlename` varchar(50) NOT NULL,
`lastname` varchar(50) NOT NULL,
`city` varchar(50) NOT NULL,
`county` varchar(50) NOT NULL,
`state` varchar(2) NOT NULL,
`termcode` varchar(6) NOT NULL,
`category` varchar(10) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
我做错了什么为什么添加一行后退出?