mysql中导入txt文件

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

load data local infile 'path' into table table_name

fields terminated by ' ' lines terminated by ' ';

注意:这里的引号全是正常的单引号,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

);

注意的是引号的不同。

原文地址:https://www.cnblogs.com/baiting/p/5038328.html