Roshan Kumar
Roshan Kumar

Reputation: 463

LOAD DATA LOCAL INFILE file request rejected due to restrictions on access

I am getting this error "LOAD DATA LOCAL INFILE file request rejected due to restrictions on access" while working on MySQL workbench. I am new to Mysql. I found a similar post in StackOverflow but none of them work for me.

CREATE DATABASE assignment02;
USE assignment02;

CREATE TABLE `hss_electives`(
                         sno INT NOT NULL UNIQUE,
                         roll_number INT,
                         sname CHAR(50) NOT NULL,
                         cid CHAR(50),
                         cname CHAR(50) NOT NULL,
                         PRIMARY KEY(roll_number, cid)
                         );


 LOAD DATA LOCAL infile 'C:/ProgramData/MySQL/MySQL Server 8.0/Uploads/hss_electives.csv'
 INTO TABLE hss_electives
 fields terminated BY ','
 lines terminated BY '\n'
 ignore 1 rows;

My local_infile option is set to "ON" My local_infile option is set to "ON"

My secure_file_priv is set to the same directory where my CSV file is. Secure_file_priv =

My csv file look like this : enter image description here

Upvotes: 1

Views: 4023

Answers (1)

Roshan Kumar
Roshan Kumar

Reputation: 463

Finally, I got this answer, There is two way to correct this error :

  1. As pointed by Akina, Removing "local" word from load data local infile worked!.

  2. Solution without removing local keyword :

    • Go to your connection and then choose EDIT CONNECTION. enter image description here
    • Then Choose Advanced option and Add this line : OPT_LOCAL_INFILE=1; enter image description here -Thanks to Bill Karwin for suggesting this method!

Upvotes: 1

Related Questions