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

Client does not support charset utf8mb4_0900_ai_ci';

Open pinksuko opened this issue 1 year ago • 0 comments

mysql: 8.4.2 code:

 function _M.new()
     local db, err = mysql:new()
     if not db then
        ngx.log(ngx.ERR, "failed to instantiate mysql: ", err)
        return nil, err
     end

     db:set_timeout(1000)   --1 second

     local ok, err = db:connect {
         host = "127.0.0.1",
         port = 3306,
         database = "master_db",
         user = "pinksuko",
         password = "suda.123",
		 charset = "utf8mb4",
		 max_packet_size = 1024 * 1024,
     }
	 
     if not ok then
	ngx.log(ngx.ERR, "failed to connect: ", err)
	return nil, err
      end

     return db

end

error.log:

failed to connect: charset 'utf8mb4_0900_ai_ci' is not supported

pinksuko avatar Sep 16 '24 11:09 pinksuko