mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-22 02:53:09 +00:00
add a callback for mysql auth
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user