Why is this MYSQL expression giving me an error?

mysql> LOAD DATA INFILE '/home/myuser/myproject/power/ids-ads.txt' INTO TABLE ids_ads  FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n';

ERROR 29 (HY000): File '/home/myuser/myproject/power/ids-ads.txt' not found (Errcode: 13)

There is a file. I even pasted the path into the mysql console. Permissions are correct.

In fact, I even tested it for the root user and root mysql.

-rw-r--r--   1 myuser myuser  15893 2010-12-26 20:56 ids-ads.txt
+5
source share
5 answers

Note that when you execute LOAD DATA INFILE, MySQL searches for this file on the server, not on your client machine.

If you want to use LOAD DATA INFILE to download a file that is located on the client computer (and not on the server), you must use LOAD DATA LOCAL INFILE.

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

+6
source

In the MySQL manual:

For security reasons, when reading text files located on the server, the files
must either reside in the database directory or be readable by all. Also, to use
LOAD DATA INFILE on server files, you must have the FILE privilege. For non-LOCAL
load operations, if the secure_file_priv system variable is set to a nonempty
directory name, the file to be loaded must be located in that directory. 

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

+2

... , , - '/home.../ids-ads.txt'?

0

, . , , MySQL , . /home/myuser/myproject/power/ /home/myuser? , MySQL .

0

phpmyadmin, Use LOCAL keyword. .

0

All Articles