MySQL 当文件位于另一个位置时如何使用 LOAD DATA INFILE 语句?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7965043/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to use LOAD DATA INFILE statement when file is another location?
提问by Sameek Mishra
I want to use LOAD DATA INFILE
statement to import data in my table.
我想使用LOAD DATA INFILE
语句在我的表中导入数据。
If the file is available on the same system, it works nicely and imports successfully, but when the file is located on another system, it cannot locate the path.
如果该文件在同一系统上可用,则它运行良好并成功导入,但是当该文件位于另一个系统上时,它无法找到路径。
Can anyone explain how to use the LOAD DATA INFILE
statement to import data into MySQL table from another system, or remotely?
谁能解释一下如何使用该LOAD DATA INFILE
语句将数据从另一个系统或远程导入 MySQL 表?
回答by Konerak
When you do a LOAD DATA INFILE
, the file must be on the system that is running the MySQL database, in the data path.
执行 . 时LOAD DATA INFILE
,该文件必须位于运行 MySQL 数据库的系统上的数据路径中。
If the file is on your system, add the LOCAL
keyword. The file will then be sent to the server, stored in a temporary directory, and run from there. This only works if the necessary permissons are set.
如果文件在您的系统上,请添加LOCAL
关键字。然后该文件将被发送到服务器,存储在一个临时目录中,并从那里运行。这只有在设置了必要的权限时才有效。
LOAD DATA LOCAL INFILE '/path/to/your/local/file' INTO TABLE yourtable