Nurav
Nurav

Reputation: 177

How to disable secure_file_priv in MySQL 8.0 in windows 10 machine?

I tried to load csv file into table using

load  data infile 'C:\\a.csv' into table errorClick columns terminated by ',' lines terminated by ',\r\n' ignore 1 lines;

I am using sql version 8.0 It gave error:

Error Code: 1290. The MySQL server is running with the --secure-file-priv option so it cannot execute this statement    0.000 sec

I ran this statement:

SHOW VARIABLES LIKE "secure_file_priv";

The result is

secure_file_priv    C:\ProgramData\MySQL\MySQL Server 8.0\Uploads\

Then i tried

 Set secure_file_priv="";

It gave result

Error Code: 1238. Variable 'secure_file_priv' is a read only variable   0.047 sec

Then I tried to find my.ini in my windows 10 machine at location

C:\ProgramData\MySQL\MySQL Server 8.0\

I did not find any my.ini file; Please help me resolve this error;

Upvotes: 2

Views: 14774

Answers (2)

Morey
Morey

Reputation: 629

You can set the secure-file-priv parameter to an empty string in my.ini

secure-file-priv = ""

and restart the MySQL server.

Keep in mind that for it to work, mysqld (MySQL service) has to run (log on) as "Local System Account" in Windows as shown below

enter image description here

Upvotes: 0

nbk
nbk

Reputation: 49375

you can only change it in my.inio file and then restart he server

You find my.ini in a hidden folder

C:\ProgramData\MySQL\MySQL Server 8.0

There you find under the section

[mysqld]

secure-file-priv = ""

After the edit, you need to restart the server, so that the changes will take effect.

Upvotes: 2

Related Questions