问题: MYSQL和RUBY (不是rails吗?)给出错误:
此MySQL版本不允许使用所使用的命令(Mysql::Mysql)
亲爱的朋友:
2)由于以下原因失败的Ruby命令:
column = "(MACHINE_NAME , TYPE_OF_ACTION , SCORE , FILE_PATH , MD5, REGKEY , VThit, action , action_result, action_result_detail, date)"
str = "Load data local infile " + "'" + "remediation_rewrite.csv" + "'" + " into table report.remediation" + " IGNORE 1 lines " + "#{column}" + ";";
p str
@con = Mysql.new("172.16.10.193", "myusername","xxx", "reporttdatabase")
@con.options(Mysql::OPT_LOCAL_INFILE, true)
rs = @con.query(str)发布于 2015-03-24 19:20:49
根据“mysql2”gem文档,出于安全原因,您需要将:local_infile指定为true (说明这里,并引用这里)。
将此替换为@con客户端对象:
@con = Mysql2::Client.new(
host: "172.16.10.193",
username: "myusername",
password: "xxx",
database: "reporttdatabase",
local_infile: true
)https://stackoverflow.com/questions/29240297
复制相似问题