MySQL Forums
Forum List  »  Newbie

Re: Loading CSV Data with commas
Posted by: Jim Palmer
Date: May 26, 2021 08:19AM

Thanks for replying, but I continue to struggle with trying to understand how to get MySQL properly configured to be able to LOAD DATA from a csv.

I have tried to gain the proper understanding of the Mac OS X folder structure, hopefully defining folders in the proper location and providing the proper permissions to these folders/files as well as providing the proper values in my MySQL statements or configuration.

To that end, here is what I have done:

- I have created a folder on my Macintosh HD > jkpalmer > mysqlfiles

- I have populated a file in this folder named Sample.csv

- I have updated my.cnf file located in the /private/etc folder to contain the following:

[mysqld]
secure-file-priv = /mysqlfiles/

-I have stopped and started MySQL

-I have created a schema named "finances" in MySQL

-I have created a table named "MCC_Codes" in the finances schema

-I have created a mysql statement as follows:

LOAD DATA INFILE '/mysqlfiles/Sample.csv'
INTO TABLE finances.MCC_Codes
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
(mcc_code, end_mcc_code, mcc_description)
set
row_id = null;

The following error is returned:

09:12:36 LOAD DATA INFILE 'Sample.csv' INTO TABLE finances.MCC_Codes FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' (mcc_code, end_mcc_code, mcc_description) set row_id = null Error Code: 1290. The MySQL server is running with the --secure-file-priv option so it cannot execute this statement 0.00076 sec

I have tried different variations of the LOAD DATA INFILE statement but continue to receive the same 1290 error.

I can't seem to get something (that was previously configured when I installed MySQL on my Mac) to work.

I understand the intentions but can't get to the solution.

Help appreciated.

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.