Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MYSQL LOAD DATA INFILE Syntax Error - where is it wrong?

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' ;
like image 228
user670186 Avatar asked Jun 30 '26 13:06

user670186


1 Answers

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

like image 58
konsolenfreddy Avatar answered Jul 02 '26 07:07

konsolenfreddy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!