MySQL把文件导入表中

1. Mysql 把本地文件导入表中

drop table if exists wufangzhai_caigou_group;
create table wufangzhai_caigou_group
(
label VARCHAR(200) COLLATE utf8_bin,
buyer_nick VARCHAR(200) COLLATE utf8_bin,
name VARCHAR(200) COLLATE utf8_bin,
mobile VARCHAR(200) COLLATE utf8_bin,
address VARCHAR(200) COLLATE utf8_bin,
detail VARCHAR(500) COLLATE utf8_bin
); LOAD DATA LOCAL INFILE 'C:\wufangzhai_caigou_group.txt'
INTO TABLE wufangzhai_caigou_group
FIElDS TERMINATED BY ','
LINES TERMINATED BY '\n'
(label,buyer_nick,name,mobile,address,detail );

  

默认txt为中文编码,在导入时转化为utf-8编码,就会避免乱码。

上一篇:spark sql建表的异常


下一篇:Network Real Trace Analysis 2015年12月10日