工具:xshell
1、在數據庫工具創(chuàng)建表
create table use_behavior(? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? user_id int(5) not null,? ? ? #商品ID? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? item_id int(20) not null,? ? ? ?#商品名稱? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?item_category int(20) not null,? ? ? ? ?#商品類目? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?behavior_type varchar(45) not null,? ? #行為類型? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? create_time int(20) not null);? ?#時間戳

2、將表上傳到 /tmp
1、rz 上傳
2、pwd查看路徑
注:為什么要上傳到/tmp目錄呢?
原因是:mysql默認使用了/tmp作為臨時讀寫目錄

3、進入MySQL
1,進入到建表的數據庫
use chenqian;
2,查詢建的表
show tables;
3,導入
load data infile '/tmp/UserBehavior.csv'? ? ? ? ?#需要導入的文件目錄及文件名? ? ? ? ? ?into table use_behavior? ? ? ? ? ? #將要導入的數據庫表名? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?fields terminated by ','? ?#列的分隔符? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?lines terminated by '\n';? ?#回車換行符,注(linux下生成的文件,就是'\n'結尾)