linux mysql导入,Linux环境下,MySQL数据导入

工具:xshell

1、在数据库工具创建表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);   #时间戳

567614e4cedb

2、将表上传到 /tmp

1、rz 上传

2、pwd查看路径

注:为什么要上传到/tmp目录呢?

原因是:mysql默认使用了/tmp作为临时读写目录

567614e4cedb

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'结尾)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值