MySQL showing ERROR 1064 (42000) when trying to import a text file

0

I am trying to import data from a text file into a table in MySQL and it says that there is an error in the syntax in the command below:

LOAD DATA LOCAL INFILE 'arquivo.txt' 
FIELD TEMINATED BY ',' 
LINES TERMINATED BY '\r\n' (r1, r2, r3, r5, r5) 
INTO TABLE teste.resultados;

The error that is being displayed is as follows:

  

ERROR 1064 (42000): You have an error in your SQL syntax; check the   manual that corresponds to your MySQL server version for the right   syntax to use near 'FIELDS TEMINATED BY', 'LINES TERMINATED BY   'at line 1

I'm using Windows 7 and the version of my MySQL is 5.6.11.

My text file has 5 fields separated by commas, as below:

amarelo,branco,amarelo,azul,vermelho
amarelo,amarelo,azul,vermelho,branco

Thanks in advance for any help,

Augusto Cesar

    
asked by anonymous 09.07.2015 / 04:02

1 answer

0

The syntax of the LOAD DATA INFILE command is as follows:

LOAD DATA LOCAL INFILE 'arquivo.txt'
INTO TABLE teste.resultados 
FIELD TEMINATED BY ',' 
LINES TERMINATED BY '\r\n' 
(r1, r2, r3, r5, r5);
    
09.07.2015 / 09:11