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' ;
2
  • What does the error message say? Commented Feb 12, 2012 at 19:30
  • it says there is a SYNTAX error (6400) near FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n', however I dont know where that should be Commented Feb 12, 2012 at 19:30

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

2 Comments

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)
had to copy file to database directory. Works now, Great!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.