1

在我的 Rails 操作之一中,我想使用 MySql OUTFILE 从表中创建一个 csv 文件。

path = "#{Rails.root}/public/outfile.csv"
query_string = "SELECT * INTO OUTFILE '#{path}' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' FROM temp_csv_186;"
ActiveRecord::Base.connection.execute(query_string)

但每次它显示错误。

Mysql2::Error: Can't create/write to file '/home/user/Projects/Application/public/outfile.csv' (Errcode: 13): SELECT * INTO OUTFILE '/home/user/Projects/Application/public/outfile.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' FROM temp_csv_186;
4

1 回答 1

0

运行 Mysql 的任何用户是否都获得了 /home/user/Projects/Application/public/ 的写权限?

于 2013-09-25T10:39:51.873 回答