You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ngx.header.content_type="application/json;charset=utf8"
local cjson = require("cjson")
local mysql = require("resty.mysql")
local uri_args = ngx.req.get_uri_args()
local id = uri_args["id"]
local db,err = mysql:new()
if not db then
ngx.say("failed to instantiate mysql: ",err)
return
end
db:set_timeout(1000)
local ok,err,errno,sqlstate = db:connect(){
host = "127.0.0.1",
port = 3306,
database = "changgou_content",
user = "root",
password = "123456"
}
if not ok then
ngx.say("failed to connect: ", err, ": ", errno, " ", sqlstate)
return
end
local select_sql = "select url,pic from tb_content where status ='1' and category_id="..id.." order by sort_order"
res,err,errno,sqlstate = db:query(select_sql)
if not res then
ngx.say("bad result: ", err, ": ", errno, ": ", sqlstate, ".")
return
end
db:close()
local redis = require("resty.redis")
local red = redis:new()
red:set_timeout(2000)
local ip ="127.0.0.1"
local port = 6379
red:connect(ip,port)
red:set("content_"..id,cjson.encode(res))
red:close()
浏览器访问:提示
failed to connect: Client does not support authentication protocol requested by server; consider upgrading MySQL client: 1251 08004
The text was updated successfully, but these errors were encountered:
ngx.header.content_type="application/json;charset=utf8"
local cjson = require("cjson")
local mysql = require("resty.mysql")
local uri_args = ngx.req.get_uri_args()
local id = uri_args["id"]
local db,err = mysql:new()
if not db then
ngx.say("failed to instantiate mysql: ",err)
return
end
db:set_timeout(1000)
local ok,err,errno,sqlstate = db:connect(){
host = "127.0.0.1",
port = 3306,
database = "changgou_content",
user = "root",
password = "123456"
}
if not ok then
ngx.say("failed to connect: ", err, ": ", errno, " ", sqlstate)
return
end
local select_sql = "select url,pic from tb_content where status ='1' and category_id="..id.." order by sort_order"
res,err,errno,sqlstate = db:query(select_sql)
if not res then
ngx.say("bad result: ", err, ": ", errno, ": ", sqlstate, ".")
return
end
db:close()
local redis = require("resty.redis")
local red = redis:new()
red:set_timeout(2000)
local ip ="127.0.0.1"
local port = 6379
red:connect(ip,port)
red:set("content_"..id,cjson.encode(res))
red:close()
浏览器访问:提示
failed to connect: Client does not support authentication protocol requested by server; consider upgrading MySQL client: 1251 08004
The text was updated successfully, but these errors were encountered: