我已检查过apparmor并授予该文件的权限:
LOAD DATA LOCAL INFILE '/home/toUpload.txt' INTO TABLE table_name (value0,value1,value2);
将返回:
ERROR 2 (HY000): File '/home/toUpload.txt' not found (Errcode: 2)
我正在运行Ubuntu 14.04 LTS的aws
答案 0 :(得分:0)
不完全正确。
你是对的;事实证明,出于任何善意的原因,这种mysql默认情况下不允许从本地infile加载。
mysql> LOAD DATA LOCAL INFILE '/home/toUpload.txt' INTO TABLE table_name;
ERROR 1148 (42000): The used command is not allowed with this MySQL version
mysql>
monte@oobun2:~$ mysql -h localhost -u monte -p monte --local-infile
Enter password:
...
mysql> LOAD DATA LOCAL INFILE '/home/toUpload.txt' INTO TABLE table_name;
Query OK, 8 rows affected (0.04 sec)
Records: 8 Deleted: 0 Skipped: 0 Warnings: 0
mysql> SELECT * FROM table_name;
+----------+--------+---------+------+------------+------------+
| name | owner | species | sex | birth | death |
+----------+--------+---------+------+------------+------------+
| Fluffy | Harold | cat | f | 1993-02-04 | NULL |
| Claws | Gwen | cat | m | 1994-03-17 | NULL |
| Buffy | Harold | dog | f | 1989-05-13 | NULL |
| Fang | Benny | dog | m | 1990-08-27 | NULL |
| Bowser | Diane | dog | m | 1979-08-31 | 1995-07-29 |
| Chirpy | Gwen | bird | f | 1998-09-11 | NULL |
| Whistler | Gwen | bird | NULL | 1997-12-09 | NULL |
| Slim | Benny | snake | m | 1996-04-29 | NULL |
| Puffball | Diane | hamster | f | 1999-03-30 | NULL |
+----------+--------+---------+------+------------+------------+
9 rows in set (0.00 sec)
答案 1 :(得分:-1)
将您的文件保存在/ tmp文件夹中并尝试相同的命令,因为mysql用户应该有权从源目录中读取文件。