Bug #33694 ERROR 13 (HY000): Can't get stat of '<file>' (Errcode: 2)
Submitted: 4 Jan 2008 17:08 Modified: 5 Jan 2008 15:17
Reporter: Thomas Whatever Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: General Severity:S2 (Serious)
Version:Ver 14.7 Distrib 4.1.21 OS:Linux
Assigned to: CPU Architecture:Any

[4 Jan 2008 17:08] Thomas Whatever
Description:
I have a same problem on SuSE Linux 9.3

mysql> LOAD DATA INFILE "/home/ipnicks_uwc3" INTO TABLE uwc3_incoming FIELDS TERMINATED BY
',' ENCLOSED BY '"' LINES TERMINATED BY '\n';
ERROR 13 (HY000): Can't get stat of '/home/ipnicks_uwc3' (Errcode: 2)

Directory and file are world-readable (strange requirement, BTW):

drwxr-xr-x  17 root root 4096 Jan  4 17:50 /home/
-rw-r--r--  1 web1 tomcat 100 Jan  4 17:51 /home/ipnicks_uwc3

MySQL used:
mysql  Ver 14.7 Distrib 4.1.21, for pc-linux-gnu (i686) using readline 4.3

Several scripts do not run for over a year now because of this error ...
:-/
In an earlier version of MySQL that worked flawlessly!

How to repeat:
Just try a "load data infile" on a file that is not contained in the mysql-data directory ...
[4 Jan 2008 17:10] Thomas Whatever
My setup for data-collection is not running for over a year now - i did not notice this bug after upgrading MySQL.
[4 Jan 2008 18:48] Susanne Ebrecht
Many thanks for writing a bug report.

Unfortunately, I have no idea what "mysql  Ver 14.7 Distrib 4.1.21" should be, we don't have such a version.

Please, use CLI and let us know the result of: 
mysql> select version();

Our newest stable version is MySQL 5.0.51, you can download the source code from our web page. Please try these version or our release candidate: MySQL 5.1.22-rc (you can download this from our web page too).

After trying the newest version, let us know, if the error still occurs.
[5 Jan 2008 0:01] Thomas Whatever
Now, this is the same version-string:

mysql> select version();
+---------------------+
| version()           |
+---------------------+
| 4.1.21-standard-log |
+---------------------+
1 row in set (0.00 sec)

mysql> Bye

austria073:~ # mysql --version
mysql  Ver 14.7 Distrib 4.1.21, for pc-linux-gnu (i686) using readline 4.3

Anyway, i cannot upgrade to version 5 as i have too much dependencies!

So, i would need a hint how to allow MySQL to read data-files without this strange security-behavior ...
I seem to read something about a variable "local-file" or something to allow such reading, but could not find no further information:

This is the string for /etc/my.cnf:

set-variable=local-infile=0

Can you say something about this?!?

Thanx a bunch!
[5 Jan 2008 0:04] Thomas Whatever
As it seems, this is a know bug and problem:

http://dev.mysql.com/doc/refman/5.0/en/load-data-local.html

Still, i am not sure how to enable read files the easiest way - i cannot re-compile nothing :-(

Any idea?
[5 Jan 2008 0:13] Thomas Whatever
Ahhhh, i found it!

This "bug" just requires me to add a "LOCAL" to "LOAD DATA" - then, it seems to work!

Very strange idea!!!!

:-(((((
[5 Jan 2008 15:17] Valeriy Kravchuk
So, looks like this is not a bug.