mysql - Trouble with loading a csv from a migration script in rails -
when trying load csv migration script using this:
activerecord::base.connection.execute( "load data local infile 'my_data.csv' table my_table fields terminated ',' lines terminated '\n' (column1, column2)
i get:
mysql2::error: used command not allowed mysql version: load data local infile....
i have added appropriate settings my.cnf:
[mysqld] local-infile=1 [mysql] local-infile=1
if run "load data local infile" command mysql client (e.g., mysql -uname -p) works great. reason in migration script (from rails) fails "not allowed mysql version".
i had problem when using activerecord-fast-import (which based on same type of import query), , found out that, security reasons, both server , client need have enabled.
the setting on (my.cnf
) indeed needed server. enable on client, add database.yml
:
local_infile: true
Comments
Post a Comment