local cjson = require "cjson"
local mysql = require "resty.mysql"
local db, err = mysql:new()
if not db then
ngx.say("new mysql error : ", err)
return
end
db:set_timeout(1000)
local props = {
host = "127.0.0.1",
port = 3306,
database = "mysql",
user = "root",
password = "123456"
}
local res, err, errno, sqlstate = db:connect(props)
if not res then
ngx.say("connect to mysql error : ", err, " , errno : ", errno, " , sqlstate : ", sqlstate)
end
连接这一步就报错了。 failed to receive the result packet: failed to receive packet header: closed
网上找了半天,没找到原因,麻烦帮忙看一下。