Import a Single Field Text File into MySQL

Posted by Kirk on Stack Overflow See other posts from Stack Overflow or by Kirk
Published on 2010-03-19T00:10:10Z Indexed on 2010/03/23 23:03 UTC
Read the original article Hit count: 279

Filed under:
|

I have a text file that looks like this:

value1
value2
value3

There are 32 million lines. Each line is terminated by a \n. The fields are not enclosed or delimited with any characters. I'm trying to import it into MySQL using this code, but it is not working:

LOAD DATA LOCAL INFILE 'data.txt'
INTO TABLE `table`
FIELDS TERMINATED BY ''
ENCLOSED BY ''
LINES TERMINATED BY '\n'
(`column1`)

Can anyone tell me what I'm doing wrong?

© Stack Overflow or respective owner

Related posts about mysql

Related posts about import