首先是从windos拷贝txt到linux,里面牵涉到coding不一样,我修改了,命令:set fileencoding=utf-8
接着我在mysql进行load data infile,出错,报错如下:
ERROR 29 (HY000): File '/home/1.txt' not found (Errcode: 13)
我文件确实存在啊。
我做了很多尝试,
1、首先是有人说load data local infile可以解决这个问题,但是我版本不支持,pass。
2、有人说,将/home/1.txt 修改成mysql 的属主。例如,
chown mysql:mysql /home/1.txt
这个有成效吗,没有。
3、
The problem can be resolved by configuring AppArmor, see this thread : http://stackoverflow.com/questions/2...t-into-outfile, or directly :
sudo vi /etc/apparmor.d/usr.sbin.mysqld
...
/var/log/mysql/ r,
/var/log/mysql/* rw,
/var/run/mysqld/mysqld.pid w,
/var/run/mysqld/mysqld.sock w,
/home/ r,
/home/* rw,
}
# sudo /etc/init.d/apparmor reload
/home/ r,
/home/* rw,
是需要我们添加的。
意思就是说让mysql有权限去读写/home 这个目录。
我做了这个,成功了。
参考文:
http://ubuntuforums.org/showthread.php?t=822084
http://stackoverflow.com/questions/2783313/how-can-i-get-around-mysql-errcode-13-with-select-into-outfile