LOAD DATA INFILE Error Code : 13

后端 未结 19 2528
有刺的猬
有刺的猬 2020-11-28 02:37

In my remote MySQL, when I try to execute this query, I am getting the MySQL Error Code : 13.

Query -

LOAD DATA INFILE 
\'/httpdocs/.../.../testFile.         


        
19条回答
  •  甜味超标
    2020-11-28 03:16

    This is normally a file access permissions issue but I see your already addressing that in point b, but it's worth going over just in case. Another option is to use LOAD DATA LOCAL INFILE which gets past a lot of these issues of file access permissions. To use this method though you need to copy the file locally (in the mysql folder is best) first. •If LOCAL is specified, the file is read by the client program on the client host and sent to the server.

    Insufficient Directory Permissions

    The error in this example has resulted because the file you are trying to import is not in a directory which is readable by the user the MySql server is running as. Note that all the parent directories of the directory the is in need to be readable by the MySql user for this to work. Saving the file to /tmp will usually work as this is usually readable (and writable) by all users. The error code number is 13. Source

    EDIT:

    Remember you will need permissions on not just the folder the holds the file but also the upper directories.

    Example from this post on the MySql Forums.

    If your file was contained within the following strucutre: /tmp/imports/site1/data.file

    you would need (I think, 755 worked) r+x for 'other' on these directories:

    /tmp

    /tmp/imports

    As well as the main two:

    /tmp/imports/site1

    /tmp/imports/site1/data.file

    You need the file and directory to be world-readable. Apologies if you've already tried this method but it may be worth retracing your steps, never hurts to double check.

提交回复
热议问题