I am connecting to a mysql database from lua using :
mysql = require "luasql.mysql"
local env = mysql.mysql()
local conn = env:connect(database,userName,password)
but the option local-infile is not activated so my requests using LOAD DATA don't work. I tried to put the line
local-infile = 1
in the file my.cnf in the field [client] but it still doesn't work. FYI : I am using linux and mysql 5.1.
I went through the same situation last week. The query
LOAD DATA INFILEworked on Mac OSX, but I could not make it work on Ubuntu. The only way I found to make it work was adding one line of code to the LuaSQL project and recompiling it.I used the MySQL driver's function
mysql_options(you can check its prototype in themysql.hfile, probably located at/usr/include/mysql) to enable thelocal-infile. You can check the code at the repository.To compile and install this workaround, you should download the files:
To compile and install :
Note: Depending on where your Lua and MySQL folders are located, you may need to set the proper values for the LUA_LIBDIR, LUA_DIR , LUA_INC , DRIVER_LIBS and DRIVER_INCS in the
configfile within the LuaSQL folder.Hope it helps.