Re: Unable to use Upload command on machine that is running MySQL and contains file to uploau
So I verified I am using the local command and am loading the file from a file on my machine. I also verified the file was in the upload directory which didn't work.
-- script I used is below.
LOAD DATA LOCAL INFILE
"C:\ProgramData\MySQL\MySQL Server 8.0\Uploads\website_visits_data.csv"
INTO TABLE `website_visits`
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 LINES
(ID, CUSTOMER_NAME, CUSTOMER_TYPE, DATE_STARTED, DURATION,
GENDER,AGE,SALARY,REVIEW_DURATION,RELATED_DURATION,PURCHASED);
I used the SHOW VARIABLES LIKE "secure_file_priv"; query to verify the path was correct and received a response of "C:\ProgramData\MySQL\MySQL Server 8.0\Uploads"
I turned off the the "secure-file-priv" setting by adding = '' to the "# secure-file-priv" statement in my "my.ini" file and checked the setting by using the statement below.
SHOW VARIABLES LIKE "secure_file_priv";
I received a response of null
I still received the error code 1148 The used command is not allowed with this MySQL version. When I tried to load the file.
I then added the file to a local documents drive and updated the path in my script. The script is below.
LOAD DATA LOCAL INFILE
"C:\Users\david\Documents\MySQL"
INTO TABLE `website_visits`
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 LINES
(ID, CUSTOMER_NAME, CUSTOMER_TYPE, DATE_STARTED, DURATION,
GENDER,AGE,SALARY,REVIEW_DURATION,RELATED_DURATION,PURCHASED);
I received the same error. I am running version the community edition version 8.013 with Windows 10, not sure if that makes a difference. Thanks for your help and I would appreciate any additional insight into how to resolve the error.