When importing mysql Data today, the following error occurs:
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)
At first, I thought it was a problem with the/root/aaa File Permission or the mysql root User permission. Later I thought it was wrong. The mysql root User is a Super User and must have the permission, the problem lies in the permission of the/root/aaa file. Later, the/root/aaa permission is changed to 777. After the operation is executed, it still does not work.
Haha, it turns out that the permission of the file directory where the aaa file is located is good. Switch to/tmp/aaa and perform the above operations:
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!
The reason for using the/tmp directory is that mysql uses/tmp as the temporary read/write directory by default.
Mysql> show variables like '% tmpdir % ';
+ ----------------- + ------- +
| Variable_name | Value |
+ ----------------- + ------- +
| Slave_load_tmpdir |/tmp |
| Tmpdir |/tmp |
+ ----------------- + ------- +
2 rows in set (0.00 sec)
Author: "linux"