I am trying to load data into mysql database using
LOAD DATA LOCAL
INFILE A.txt
INTO DB
LINES TERMINATED BY '|';
the topic of this question is the response I get. I understand the local data offloading is off by default and I have to enable it using a the command local-infile=1
but I do not know where to place this command.
You can specify that as an additional option when setting up your client connection:
This is because that feature opens a security hole. So you have to enable it in an explicit manner in case you really want to use it.
Both client and server should enable the local-file option. Otherwise it doesn't work.To enable it for files on the server side server add following to the
my.cnf
configuration file:http://dev.mysql.com/doc/refman/5.6/en/load-data-local.html
Put this in my.cnf - the
[client]
section should already be there (if you're not too concerned about security).All of this didn't solve it for me on my brand new Ubuntu 15.04.
I removed the
LOCAL
and got this command:but then I got:
That led me to this answer from Nelson to another question on stackoverflow which solved the issue for me!
I find the answer here.
It's because the server variable
local_infile
is set to FALSE|0. Refer from the document.You can verify by executing:
If you have SUPER privilege you can enable it (without restarting server with a new configuration) by executing: