lua-resty-mysql icon indicating copy to clipboard operation
lua-resty-mysql copied to clipboard

Client does not support authentication protocol requested by server; consider upgrading MySQL client: 1251 08004

Open ckall opened this issue 1 year ago • 1 comments

code:

  local mysql = require("resty.mysql")
  local db, err = mysql:new()
    if not db then
        return 500, { message = "failed to instantiate mysql: " .. err }
    end
    db:set_timeout(1000)
    local ok,errcode, sqlstate
     ok, err, errcode, sqlstate = db:connect{
        host = "127.0.0.1",
        port = 3306,
        database = "apisix_test",
        user = "root",
        password = "apisixrootpassword"
        charset = "utf8",
        max_packet_size = 1024 * 1024,
    }
    if not ok then
        return 500, { message = "failed to connect: " .. err .. ": " .. errcode .. " " .. sqlstate }
    end

resp:

{
    "message": "failed to connect: Client does not support authentication protocol requested by server; consider upgrading MySQL client: 1251 08004"
}

How can I solve it? Does it feel like an issue with the latest version of MySQL?

ckall avatar Jan 30 '24 09:01 ckall

Which version of MySQL server do you use?

zhuizhuhaomeng avatar Jan 31 '24 01:01 zhuizhuhaomeng