首先,设置MySQL的my.ini配置文件,添加 secure_file_priv=D:\MySQL
然后,重启MySQL服务
再次打开MySQL命令行,执行
create table novel_info(
novel_num varchar(32) not null,
novel varchar(100) not null,
author varchar(100) not null,
Category varchar(50) not null,
status varchar(50) not null,
words varchar(50) not null,
site varchar(200) not null,
intro text(5000) not null
);
建立和csv文件对应的数据表结构,导入csv
load data infile 'D:\\MySQL\\novel_info.csv'
into table novel_info
fields terminated by '\t' optionally enclosed by '"' escaped by '"'
lines terminated by '\r\n';