我的数据:
1: 将windows中的txt文件传入到Linux中 :
2:在mysql中将表创建好 例如:
create table users(
userid int,
time date,
id int,
sex varchar(10),
birthday date,
age int)default charset=utf8;
3:查询 show tables;
4:执行 load data local infile ‘/opt/users.txt’ into table users character set utf8 fields terminated by ‘,’ ignore 1 lines;
其中character set utf8是设置默认字符为中文, fields terminated by ‘,’ 以,为分隔符,进行切割,ignore 1 lines 忽略第一行数据