Test involving LOAD DATA INFILE, secure-file-priv problem


#1

I have a test which makes use of the MySQL LOAD DATA INFILE command, to provide test coverage on part of my application that performs a bulk data load. On Circle CI I am getting the following error message for that test:

Mysql2::Error: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement: LOAD DATA INFILE '/home/ubuntu/regdata/tmp/fts_span_line_items_import' INTO TABLE fts_span_line_items

Please advise how I can change my settings to make this test functional. Thanks.


#2

The following workaround seemed to fix the problem:

     unless ENV['CIRCLECI']
        "LOAD DATA INFILE '#{file_path}' INTO TABLE #{table_name}\n" \
        "FIELDS TERMINATED BY '|'\n" \
        "LINES TERMINATED BY '\\n'\n" \
        "(financial_institution_id,element_name,period,span,value)\n"
      else
        "LOAD DATA LOCAL INFILE '#{file_path}' INTO TABLE #{table_name}\n" \
        "FIELDS TERMINATED BY '|'\n" \
        "LINES TERMINATED BY '\\n'\n" \
        "(financial_institution_id,element_name,period,span,value)\n"
      end

Using the LOCAL option while in the Circle CI environment resolved the issue.


#3