mysql错误:ERROR 29 (HY000): File 'xxx.txt' not found (Errcode: 13)
发布:smiling 来源: PHP粉丝网 添加日期:2014-10-08 13:57:25 浏览: 评论:0
有朋友使用mysql时可能会碰到mysql错误:ERROR 29 (HY000): File \'xxx.txt\' not found (Errcode: 13)提示,下面我来给大家介绍解决办法。
突然遇到mysql错误:ERROR 29 (HY000): File '/var/www/xiaoyou/static/upload/import/20130427105733.csv.txt' not found (Errcode: 13)
感觉特奇怪,因为程序在本地很ok,语句如下:
- LOAD DATA INFILE '/var/www/upload/abc.csv.txt' INTO TABLE alumni_import FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED by ' ' IGNORE 1 lines (field1,field2,...);
我一直因为是权限问题,但是当我把目录和文件权限都chmod为777后还是出错,google了后发现:
- Recent Ubuntu Server Editions (such as 10.04) ship with AppArmor and MySQL's profile might be in enforcing mode by default. You can check this by executing
- sudo aa-status
- like so:
- # sudo aa-status 5 profiles are loaded.5 profiles are in enforce mode./usr/lib/connman/scripts/dhclient-script /sbin/dhclient3 /usr/sbin/tcpdump /usr/lib/NetworkManager/nm-dhcp-client.action /usr/sbin/mysqld 0 profiles are in complain mode.1 processes have profiles defined.1 processes are in enforce mode :/usr/sbin/mysqld (1089)0 processes are in complain mode.
- If mysqld is included in enforce mode, then it is the one probably denying the write. Entries would also be written in
- /var/log/messages
- when AppArmor blocks the writes/accesses. What you can do is edit
- /etc/apparmor.d/usr.sbin.mysqld
- and add
- /data/
- and
- /data/*
- near the bottom like so:
- ...
- /usr/sbin/mysqld {
- ...
- /var/log/mysql/ r,
- /var/log/mysql/* rw,
- /var/run/mysqld/mysqld.pid w,
- /var/run/mysqld/mysqld.sock w,
- /data/ r,
- /data/* rw,
- }
- And then make AppArmor reload the profiles.
- --phpfensi.com
- # sudo /etc/init.d/apparmor reload
大体内容就是,mysqld强制编码了,文件没有写入权限,于是我把该文件目录也加到mysqld(/etc/apparmor.d/usr.sbin.mysqld这个文件的底部,如上粗体部分:
- /var/www/upload/import/ r,
- /var/www/upload/import/* rw,
Tags: mysql错误 ERROR29 Errcode:13
相关文章
- ·MYSQL错误:Out of memory (Needed 1046596 bytes)(2014-09-28)
- ·Mysql数据库错误代码中文说明详解(2014-10-03)
- ·MySQL出现Errcode:28错误提示解决办法(2014-10-08)
- ·MYSQL错误#145的解决办法总结(2014-10-09)
- ·mysql错误代码总结(2014-10-10)
- ·mysql常用错误提示代码详解(2014-10-14)
- ·mysql出现too many connections错误提示(2014-10-14)
- ·Mysql错误Operand should contain * column解决办法(2015-04-17)
- ·MySQL下“Can’t create/write to file xxx (Errcode: 13)”错误(2014-09-27)
推荐文章
热门文章
最新评论文章
- 写给考虑创业的年轻程序员(10)
- PHP新手上路(一)(7)
- 惹恼程序员的十件事(5)
- PHP邮件发送例子,已测试成功(5)
- 致初学者:PHP比ASP优秀的七个理由(4)
- PHP会被淘汰吗?(4)
- PHP新手上路(四)(4)
- 如何去学习PHP?(2)
- 简单入门级php分页代码(2)
- php中邮箱email 电话等格式的验证(2)