mysqlmysql-workbenchmysql-8.0

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;


Solution

  • 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.