Home > Database > Mysql Tutorial > 解决mysql-can't get stat of (errcode:13)_MySQL

解决mysql-can't get stat of (errcode:13)_MySQL

WBOY
Release: 2016-06-01 13:45:08
Original
1146 people have browsed it

bitsCN.com

今天在导入mysql数据的时候,出现下面的错误:
mysql> load data infile '/root/aaa' into table test fields terminated by ',' lines terminated by '/n';
mysql> ERROR 13 (HY000): Can't get stat of '/root/aaa' (Errcode: 13)
开始还以为是/root/aaa文件权限或者是mysql的root用户权限的问题,后来想不对呀,mysql的root用户是超级用户,肯定有权限的,那问题就出在/root/aaa文件的权限上,后来把/root/aaa的权限改成777,执行操作后还是不行。
呵呵,原来是aaa文件所在的文件目录权限的问题,这个好办,换到/tmp/aaa,执行上述操作看看:
mysql> load data infile '/tmp/aaa' into table users_groups fields terminated by ',' lines terminated by '/n';
Query OK, 14 rows affected (0.01 sec)
Records: 14  Deleted: 0  Skipped: 0  Warnings: 0
ok,成功了!
之所以要用/tmp目录的原因是mysql默认使用了/tmp作为临时读写目录。
mysql> show variables like '%tmpdir%';
+-------------------+-------+
| Variable_name     | Value |
+-------------------+-------+
| slave_load_tmpdir | /tmp  |
| tmpdir            | /tmp  |
+-------------------+-------+
2 rows in set (0.00 sec)
 
作者 “linux”

bitsCN.com
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template