我正在尝试运行此查询
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/