当文件位于另一个位置时,如何使用LOAD DATA INFILE语句? [英] How to use LOAD DATA INFILE statement when file is another location?

查看:215
本文介绍了当文件位于另一个位置时,如何使用LOAD DATA INFILE语句?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用LOAD DATA INFILE语句将数据导入表中.

I want to use LOAD DATA INFILE statement to import data in my table.

如果该文件在同一系统上可用,则可以正常工作并成功导入,但是当该文件位于另一个系统上时,将无法找到该路径.

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.

任何人都可以解释如何使用LOAD DATA INFILE语句从另一个系统或远程将数据导入MySQL表吗?

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数据库的系统上的数据路径中.

When you do a LOAD DATA INFILE, the file must be on the system that is running the MySQL database, in the data path.

如果文件在您的系统上,请添加LOCAL关键字.然后,该文件将被发送到服务器,存储在一个临时目录中,然后从那里运行.仅当设置了必需的许可权时,此方法才有效

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.

LOAD DATA LOCAL INFILE '/path/to/your/local/file' INTO TABLE yourtable

这篇关于当文件位于另一个位置时,如何使用LOAD DATA INFILE语句?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆