LOAD DATA INFILE Error Code : 13

后端 未结 19 2526
有刺的猬
有刺的猬 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:35

    for Ubuntu users

    I'm running mysql 5.6.28 on Ubuntu 15.10 and I just ran into the exact same problem, I had all the necessary flags in my.cnf tmpdir = /tmp local-infile=1 restarted mysql and I would still get LOAD DATA INFILE Error Code : 13

    Just like Nelson mentionned the issue was "apparmor", sort of patronising mysql about permissions, I then found the solution thanks to this quick & easy tutorial.

    basically, assuming your tmp dir would be /tmp :

    Add new tmpdir entries to /etc/apparmor.d/local/usr.sbin.mysqld

    sudo nano /etc/apparmor.d/local/usr.sbin.mysqld
    

    *add this

    /tmp/ r,
    /mnt/foo/tmp/** rw,
    

    Reload AppArmor

    sudo service apparmor reload
    

    Restart MySQL

    sudo service mysql restart
    

    I hope that'll help few Ubuntu-ers

提交回复
热议问题