Home » Mysql » Mysql – LOAD DATA INFILE (Error Code : 13)

Mysql – LOAD DATA INFILE (Error Code : 13)

Linux–Ubuntu 12.04
Edit apparmor file

sudo vi /etc/apparmor.d/usr.sbin.mysqld 

add ‘/var/www/www_root/export/* w’ in the end of the file

/etc/mysql/*.pem r,

  /etc/mysql/conf.d/ r,

  /etc/mysql/conf.d/* r,

  /etc/mysql/*.cnf r,

  /usr/lib/mysql/plugin/ r,

  /usr/lib/mysql/plugin/*.so* mr,

  /usr/sbin/mysqld mr,

  /usr/share/mysql/** r,

  /var/log/mysql.log rw,

  /var/log/mysql.err rw,

  /var/lib/mysql/ r,

  /var/lib/mysql/** rwk,

  /tmp/** rwk,

  /var/log/mysql/ r,

  /var/log/mysql/* rw,

  /var/run/mysqld/mysqld.pid w,

  /var/run/mysqld/mysqld.sock w,

  /run/mysqld/mysqld.pid w,

  /run/mysqld/mysqld.sock w,
  /var/www/www_root/export/* w

restart apparmor

sudo /etc/init.d/apparmor reload 

On centos 5.5
1. make sure mysql user has file privilege
2. change folder onwer to mysql

 sudo chown -R mysql:mysql /var/www/www_root/exports 

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*

*