如何将数据从文本文件导入mysql数据库 [英] How to import data from text file to mysql database
问题描述
我有一个名为 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.
I想要将此文本文件数据导入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?
推荐答案
它应该像...一样简单...
It should be as simple as...
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数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!