3

where is the Synthax error here?

LOAD DATA INFILE 'mysqlout_back.txt' 
INTO TABLE temp (user,category,site,tld,ip,updated,date) 
FIELDS TERMINATED BY '\t' 
LINES TERMINATED BY '\n' ;
Nicola Cossu
  • 54,599
  • 15
  • 92
  • 98
user670186
  • 2,588
  • 6
  • 37
  • 55

1 Answers1

6

If you only want to load the data in specific columns, the go to the end:

LOAD DATA INFILE 'mysqlout_back.txt' 
INTO TABLE temp FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n' 
(user,category,site,tld,ip,updated,date) ;

EDIT, regarding the file location in your comments:

The server uses the following rules to locate the file:

  • If the file name is an absolute path name, the server uses it as given.
  • If the file name is a relative path name with one or more leading components, the server searches for the file relative to the server's data directory.
  • If a file name with no leading components is given, the server looks for the file in the database directory of the default database.

See the MySQL ref

konsolenfreddy
  • 9,551
  • 1
  • 25
  • 36
  • Ah thanks. But now I get this error: ERROR 1045 (28000): Access denied for user 'concrast'@'%. However, I have set the rights that the user concrast can import data. Now I had to set global rights for the user and it works. However, now I get this error: Can't get stat of '[path]/mysqlout_back.txt' (Errcode: 13) – user670186 Feb 12 '12 at 19:55
  • had to copy file to database directory. Works now, Great! – user670186 Feb 12 '12 at 20:02