数据库
首页 > 数据库> > MYSQL LOAD DATA INFILE语法错误 – 哪里错了?

MYSQL LOAD DATA INFILE语法错误 – 哪里错了?

作者:互联网

这里的Synthax错误在哪里?

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

解决方法:

如果您只想加载特定列中的数据,请转到结尾:

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

编辑,关于评论中的文件位置:

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.

MySQL ref

标签:load-data-infile,mysql,syntax
来源: https://codeday.me/bug/20190826/1730923.html