add a callback for mysql auth

This commit is contained in:
fztcjjl
2015-10-24 06:37:25 +08:00
parent fe3954fb04
commit 1653b3213a
2 changed files with 11 additions and 7 deletions

View File

@@ -70,14 +70,18 @@ local function test3( db)
end
skynet.start(function()
local function on_connect(db)
db:query("set charset utf8");
end
local db=mysql.connect({
host="127.0.0.1",
port=3306,
database="skynet",
user="root",
password="1",
max_packet_size = 1024 * 1024
}, function(db) db:query("set charset utf8") end)
max_packet_size = 1024 * 1024,
on_connect = on_connect
})
if not db then
print("failed to connect")
end