加载数据本地文件错误2未找到文件 [英] load data local infile ERROR 2 file not found
问题描述
针对此sql错误,我已经面对了大约45分钟,这让我觉得很愚蠢.
I've been ramming my face against this sql error for about 45 minutes, and I have a feeling it's going to be something silly.
我正在尝试将.txt文件加载到我的数据库中,该数据库位于其他服务器上.我在Windows 7上使用腻子.
I'm trying to load a .txt file into my database, which is on a server elsewhere. I'm using putty on windows 7.
我正在使用的sql调用如下:
LOAD DATA LOCAL INFILE "C:/Users/Sam/Desktop/students_data.txt" INTO TABLE students;
The sql call I am using is the following:
LOAD DATA LOCAL INFILE "C:/Users/Sam/Desktop/students_data.txt" INTO TABLE students;
我得到的答复是ERROR 2 (HYOOO): File 'C:/Users/Sam/Desktop/students_data.txt' not found (Errcode:2)
如果有人可以阐明这一点,那将是奢侈的.我已经尝试将/
切换为\
并使用单引号等,但是似乎没有任何效果.通过按住Shift并单击实际文件并将其粘贴来复制文件路径.
If anyone could shed some light on this that'd be extravagant. I already tried switching the /
to \
and using single quotes, etc., but nothing seems to work. The file path is copied by shift+clicking the actual file and pasting it.
推荐答案
我找到了一个解决方案.首先从sql语句中删除单词LOCAL.其次-通常将文件放入MySQL DATA文件夹中-bin/mysql/msql5.5.8/data/和您正在使用的数据库.它为我工作.如果文件很大,您可能要检查php.ini文件中的MAX_FILE上传编号.
I have found a solution. First delete the word LOCAL from the sql statement. Second - place your file into MySQL DATA folder usually - bin/mysql/msql5.5.8/data/and your DB with which you are working. It worked for me. You might want to check your MAX_FILE upload number in php.ini file if file is large.
这篇关于加载数据本地文件错误2未找到文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!