lua-mysql is a simple(but not complete) Lua 5.3 binding of MySQL 5.5 C API
First obtain premake5, then a C99 compiler and libmysqlclient
library is needed.
- Type
premake5 vs2013
on command window to generate Visual C++ solution files. - Use Visual Studio 2013(either Ultimate or Community version) to compile executable binary.
- Pre-compiled Windows x86/64 libmysql binary can be obtained here
- Type
sudo apt-get install libmysqlclient-dev
- Type
premake5 gmake && make config=release
local mysql = require 'luamysql'
local client = mysql.new_client()
client:connect{host = 'localhost', user = 'root', passwd = 'mypwd', db = 'test'}
local cur = client:execute('select * from test')
while true do
local r = cur:fetch()
for k, v in ipairs(r) do
print(k, v)
end
end