无法将数据从文件加载到Mysql表

时间:2016-06-21 14:27:30

标签: mysql

我无法将数据从文件加载到MySQL表。

我还应该在哪里保存文件?

文件如下所示。

notroot@ubuntu:~/lab/data$ ls
txns

notroot@ubuntu:~/lab/data$ pwd

/home/notroot/lab/data

notroot@ubuntu:~/lab/data$ mysql -u root -p

mysql> load data infile '/home/notroot/lab/data/txns' into table trans fields terminated by ',' lines terminated by '\n';
ERROR 29 (HY000): File '/home/notroot/lab/data/txns' not found (Errcode: 13)

mysql> load data local infile '/home/notroot/lab/data/txns' into table trans fields terminated by ',' lines terminated by '\n';
ERROR 1148 (42000): The used command is not allowed with this MySQL version
mysql>

1 个答案:

答案 0 :(得分:0)

运行--local-infile

时使用mysql参数
mysql --local-infile -u root -p
相关问题