首页 > 数据库 >mysql 导入 文本数据

mysql 导入 文本数据

时间:2023-01-12 15:57:55浏览次数:51  
标签:map mysql 导入 sql 文本 local infile

mysql导入文本步骤 1、修改mysql.ini ,增加配置

[mysqld]
local_infile=ON
[mysql]
local_infile=ON

2、springboot mysql配置增加 allowLoadLocalInfile=true

url: jdbc:mysql://localhost:3306/flowable?allowLoadLocalInfile=true

3、执行SQL

/*controller*/
long start = System.currentTimeMillis();
​
String sql = "load data local infile 'd:/sys_product.txt' into table `sys_product` fields terminated by '\t'";
Map<String,String> map = new HashMap<>();
map.put("sql",sql);
sysProductService.execute(map);
​
long end = System.currentTimeMillis();
return "运行时间(毫秒): = " + (end - start);
​
​
​
/*mapper*/
@Insert("${sql}")
void execute(Map<String, String> map);

 

 

标签:map,mysql,导入,sql,文本,local,infile
From: https://www.cnblogs.com/jssoft/p/17046891.html

相关文章