当前位置:Gxlcms > mysql > 解决mysql-can'tgetstatof(errcode:13)_MySQL

解决mysql-can'tgetstatof(errcode:13)_MySQL

时间:2021-07-01 10:21:17 帮助过:6人阅读

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

人气教程排行