MySQL: 数据的导入

数据的导入

方法1 :图形工具

方法2: SQL 语句

load data infile 文件路经 into table <table name> fields terminated by ' ' lines terminated by '\r\n'

空格: fields terminated by ' \t'

逗号:fields terminated by ', '

in windown, the file address is ,e.g D:\Study\MySQL, here <file address> should be ' D:/Study/MySQL'

csv format 

 去掉第一行标题行

load data infile 'D:/stuScore_data.csv'
into table StuScore FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n';

保留第一行标题行

load data infile 'D:/stuScore.csv'
into table StuScore2 fields terminated by ',' enclosed by '"'  ignore 1 lines;

text format:

load data infile 'D:/Python/StuInfo_import.txt' into table StuInfo fields terminated by ',' lines terminated by '\r\n';

 

错误:1290

 

****错误:1290 - The MySQL server is running with the --secure-file-priv option so it cannot execute this statement 

处理方式:修改mysql配置文件my.ini中secure-file-priv的值,为空任意文件目录导出,配置目录为指定目录导入导出。

如何找配置文件my.ini?

win10,直接查找 服务 ->属性

 


 

 

 

 

 

 

 

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值