MYSQL LOAD DATA INFILE语法错误 - 它错在哪里?

问题描述:

这里是Synthax错误吗?MYSQL LOAD DATA INFILE语法错误 - 它错在哪里?

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

什么是e恐怖消息说? – 2012-02-12 19:30:08

+0

它说在FIELDS TERMINATED BY'\ t'LINES TERMINATED BY'\ n'附近有一个SYNTAX错误(6400),但是我不知道应该在哪里 – user670186 2012-02-12 19:30:51

如果你只想要加载特定列中的数据,去到最后:

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

+0

啊谢谢。但现在我得到这个错误:错误1045(28000):访问拒绝用户'concrast'@'%。但是,我已经设置了用户concrast可以导入数据的权限。现在我必须为用户设置全局权限并且它可以工作。但是,现在我得到这个错误:无法获得'[path] /mysqlout_back.txt'(Errcode:13)的统计信息 – user670186 2012-02-12 19:55:04

+0

@ user670186:请参阅我的关于文件位置的编辑。 – konsolenfreddy 2012-02-12 20:00:35

+0

必须将文件复制到数据库目录。现在工作,太好了! – user670186 2012-02-12 20:02:27