mysql - SQL加载数据并发infile

标签 mysql heidisql

我正在尝试运行此查询

LOAD DATA CONCURRENT INFILE 'C:\\Data-API.csv' INTO TABLE pbp_person
FIELDS TERMINATED BY '\t' ENCLOSED BY '"' LINES TERMINATED BY '\r\n' IGNORE 1 LINES
(email, first_name, last_name, title, company_name, address, city, state, zip, country, phone, vertical);

但我收到一条错误消息......

SQL 错误 (29) 找不到文件“C:\Data-API.csv”(Errcode:2)

文件在正确的地方;发生什么事了?

最佳答案

文件在服务器上吗?因为您没有指定LOCAL,所以必须在服务器主机上指定文件。

如果它在客户端中,那么使用这个:

LOAD DATA CONCURRENT *LOCAL* INFILE 'C:\\Data-API.csv' INTO TABLE pbp_person
FIELDS TERMINATED BY '\t' ENCLOSED BY '"' LINES TERMINATED BY '\r\n' IGNORE 1 LINES
(email, first_name, last_name, title, company_name, address, city, state, zip, country, phone, vertical);

引用this .

If LOCAL is not specified, the file must be located on the server host and is read directly by the server. 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 - SQL加载数据并发infile,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11655521/

相关文章:

php - 查询结果数组,每一行的列字段为字符串

mysql - 数据库文件莫名其妙的增长

mysql - 如何在我使用 mysql 导入的 CSV 中查找和替换

mysql - 从其他两列计算 SQL 中的获胜百分比

mysql - 您不能在 FROM 子句中指定要更新的目标表 'barang'

php - 列表元素的识别 - PHP

MySQL 外键设置

mysql - INSTR SQL 中的\n

foreign-keys - 尝试使用heidisql在mysql中添加外键

MySQL 无法在 XAMPP 和 HeidiSQL 上启动