tags:

views:

35

answers:

2

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?

A: 

did you try using double quotes instead of single quotes? it might be interpreting '\n' as a literal - this happens in some other languages and might be the case here

CheeseConQueso
A: 

Turns out I was being too explicit. This did it:

LOAD DATA LOCAL INFILE 'data.txt'
INTO TABLE `table`
ENCLOSED BY ''
(`column1`)
Kirk