How to import data from text file to mysql database(如何将文本文件中的数据导入mysql数据库)
问题描述
我有一个名为 text_file.txt
的 350MB 文件,其中包含此制表符分隔的数据:
I have a 350MB file named text_file.txt
containing this tab delimited data:
345868230 1646198120 1531283146 Keyword_1531283146 1.55 252910000
745345566 1646198120 1539847239 another_1531276364 2.75 987831000
...
MySQL 数据库名称:Xml_Date
MySQL Database name: Xml_Date
数据库表:PerformanceReport
我已经创建了包含所有目标字段的表.
I have already created the table with all the destination fields.
我想将此文本文件数据导入到 MySQL 中.我用谷歌搜索并找到了一些命令,例如 LOAD DATA INFILE
并且对如何使用它感到非常困惑.
I want to import this text file data into a MySQL. I googled and found some commands like LOAD DATA INFILE
and quite confused on how to use it.
如何导入此文本文件数据?
How can I import this text file data?
推荐答案
应该就这么简单...
LOAD DATA INFILE '/tmp/mydata.txt' INTO TABLE PerformanceReport;
默认情况下 LOAD DATA INFILE
使用制表符分隔,每行一行,所以应该很好.
By default LOAD DATA INFILE
uses tab delimited, one row per line, so should take it in just fine.
这篇关于如何将文本文件中的数据导入mysql数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何将文本文件中的数据导入mysql数据库


基础教程推荐
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- 带有WHERE子句的LAG()函数 2022-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
- 从字符串 TSQL 中获取数字 2021-01-01
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- 带更新的 sqlite CTE 2022-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01