mysql中导入txt文件

1 windows 下 mysql导入txt文件(使用mysql的workbench)

load data local infile 'path' into table table_name

fields terminated by '\t' lines terminated by '\r\n';

注意:这里的引号全是正常的单引号,ptah的格式为绝对路径(每个反斜杠之后再加一个反斜杠,转义),如:C:\\Users\\DELL\\Desktop\\data\\Data\\JingdongData\\record_all.txt

2,mysql 创建表

create table table_name

( userid int(11) not null;

  productid int(11) not null

);

或者都加ESC下面的波浪引号,如:

create table `table_name`

(

  `userid` int(11) not null;

   `productid` int(11) not null

);

注意的是引号的不同。

 

posted @ 2015-12-11 10:54  白婷  阅读(1132)  评论(0编辑  收藏  举报