0

I finally installed (I think) luasql-mysql in windows but I can't seem to run

local mysql = require("luasql-mysql").

Below are the relevant images:

Image of Installed luasql-mysql .

Error in simple command

It seems like I only have mysql.dll after installation.

bonez001
  • 1
  • 3
  • `require 'luasql.mysql'` ? – moteus Oct 12 '16 at 10:29
  • It is still module not found. I did a search in windows and it seems like there is no luasql.mysql LUA file. Did I miss something? Thanks a lot. – bonez001 Oct 12 '16 at 10:31
  • Should there be luasql.lua that need to be installed? – bonez001 Oct 12 '16 at 10:40
  • there should be `luasql\mysql.dll` file. – moteus Oct 12 '16 at 10:46
  • Yes. I found the mysql.dll file. Do I need to put it in environment path? Thanks. – bonez001 Oct 12 '16 at 11:00
  • Call `luarocks path` and you should see what you need to add to environment. (there 2 variables LUA_PATH and LUA_CPATH) – moteus Oct 12 '16 at 11:10
  • Copy your `luasql\mysql.dll` file to `c:\gcc-lua-install\lua-5.1\src\luasql\mysql.dll` and try `require 'luasql.mysql'` – Egor Skriptunoff Oct 12 '16 at 12:51
  • Hello moteus thank you so much for your help. I added the variable but I got the following error: error loading module 'luasql.mysql' from file 'C:\gcc-lua-install\lua-5.1\src\systree/lib/lua/5.1luasql\mysql.dll: the specified module could not be found. – bonez001 Oct 13 '16 at 04:56
  • By the way, I change something in luasql-mysql-csv-1.rockspec, does this matter? - sources = { "C:/Users/pc/Desktop/luasql-master/src/luasql.c", "C:/Users/pc/Desktop/luasql-master/src/ls_mysql.c" }, – – bonez001 Oct 13 '16 at 05:24
  • `C:\gcc-lua-install\lua-5.1\src\systree/lib/lua/5.1luasql\my‌​sql.dll` forgot slash after `lua\5.1`. LUA_PATH value should contains `C:\gcc-lua-install\lua-5.1\src\systree\lib\lua\5.1\?.lua` – moteus Oct 13 '16 at 05:29
  • @moteus thanks. I followed it. At least I have a new error: "error loading module 'luasql.mysql' from file 'C:\gcc-lua-install\lua-5.1\src\systree/lib/lua/5.1/luasql\mysql.dll – bonez001 Oct 13 '16 at 06:07
  • I have given up on running anything other than standard lua on windows a long time ago xD – DarkWiiPlayer Oct 13 '16 at 08:31
  • Sorru it should be LUA_CPATH and ending with `?.dll` not `?.lua` – moteus Oct 13 '16 at 08:34
  • I am still getting error after adding C:\gcc-lua-install\lua-5.1\src\systree\lib\lua\5.1\?.dll in LUA_CPATH in user and system variables. Maybe I should just use node.js instead of using luasql for interfacing database. Thanks moteus. – bonez001 Oct 13 '16 at 09:07
  • I hope you remove preview line from LUA_PATH? – moteus Oct 13 '16 at 13:29
  • @DarkWiiPlayer Other operating system ok? – bonez001 Oct 14 '16 at 01:01

0 Answers0