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”
Copyright 2014-2024 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号