MYSQL LOAD DATA INFILE Syntax Error - 哪里错了?

标签 mysql syntax 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

关于MYSQL LOAD DATA INFILE Syntax Error - 哪里错了?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9251937/

相关文章:

mysql - 在 MySQL 中安全地存储用户数据?

mysql - 如何优化查询以查找大型表的随机值

java - 创建序列时出现 SQL 错误

mysql - LOAD DATA LOCAL INFILE 失去连接,如何解决超时问题?

mysql - 如何在不创建表(架构)的情况下从文本文件加载mysql中的数据

php - AJAX:没有从数据库中获取关联数组

php insert into mysql 成功并返回insert id,但是mysql数据库没有记录,为什么?

string - Rust 中的 r #""# 运算符是什么?

c# - 在 C#/WPF 中确定控件类型的最有效方法

php - LOAD DATA INFILE 不适用于 FIELDS TERMINATED BY