MySQL LOAD DATA错误(错误代码:2-“无此文件或目录") [英] MySQL LOAD DATA Error (Errcode: 2 - "No such file or directory")

查看:262
本文介绍了MySQL LOAD DATA错误(错误代码:2-“无此文件或目录")的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将数据加载到我的MySQL数据库的表中,并得到此错误.

I am trying to load data into a table of my MySQL database, and getting this error.

LOAD DATA LOCAL INFILE 'C:\Users\Myself\Desktop\Blah Blah\LOAD DATA\week.txt' 
INTO TABLE week;

参考:

该路径是100%正确的,我通过按shift键并单击将路径复制为"将其复制并进行了多次检查. 因此,对此的任何提示将不胜感激. . 我的研究:看到答案,我尝试通过将C:\Users更改为C:\\Users.它对我不起作用.

The path is hundred percent correct, I copied it by pressing shift and clicking "copy path as" and checked it many times. So any tips on this will be much appreciated. . My research: Seeing this answer, I tried by changing C:\Users to C:\\Users. It did not work for me.

第二,是否可以在此处使用某种相对路径(而不是绝对路径)?

推荐答案

我不知道您使用的是哪个版本的MySQL,但通过Google的快速搜索找到了两个问题的可能答案.以下摘录自 MySQL 5.1参考手册:

I don't know what version of MySQL you are using but a quick Google search found possible answers to both your questions. Below are excerpts from the MySQL 5.1 Reference Manual:

文件名必须以文字字符串形式给出.在Windows上,指定 路径名称中的反斜杠为正斜杠或加倍的反斜杠

The file name must be given as a literal string. On Windows, specify backslashes in path names as forward slashes or doubled backslashes

LOCAL关键字会影响文件的预期位置:

The LOCAL keyword affects where the file is expected to be found:

如果指定了LOCAL,则客户端程序将在该文件上读取该文件. 客户端主机并发送到服务器.该文件可以作为完整文件给出 路径名称以指定其确切位置.如果给出为相对路径 名称,该名称是相对于其中的目录解释的 客户端程序已启动.

If LOCAL is specified, the file is read by the client program on the client host and sent to the server. The file can be given as a full path name to specify its exact location. If given as a relative path name, the name is interpreted relative to the directory in which the client program was started.

致谢.

这篇关于MySQL LOAD DATA错误(错误代码:2-“无此文件或目录")的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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