I am learning MySQL and tried using a LOAD DATA
clause. When I used it as below:
LOAD DATA INFILE "text.txt" INTO table mytable;
I got the following error:
The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
How do I tackle this error?
I have checked another question on the same error message, but still can’t find a solution.
I am using MySQL 5.6
If the file is local to your machine use the LOCAL in your command
Here is what worked for me in Windows 7 to disable
secure-file-priv
(Option #2 from vhu's answer):services.msc
.C:\ProgramData\MySQL\MySQL Server 5.6
(ProgramData
was a hidden folder in my case).my.ini
file in Notepad.services.msc
.For MySQL Server 5.7.16 and above, please refer to dbc's comment below.
On Ubuntu 14 and Mysql 5.5.53 this setting seems to be enabled by default. To disable it you need to add
secure-file-priv = ""
to your my.cnf file under the mysqld config group. eg:-The thing that worked for me:
secure-file-priv
.To find that type:
local_infile = 1
.Do that typing:
If you get:
Then set it to one typing: