The mysql-proxy read_query method implements authentication connection after special SQL is executed. In mysql-proxy, you can set session variables, this function allows you to perform Secondary authentication by executing the specified SQL statement after obtaining the database connection. If no secondary authentication is performed, all requests connected to the database are intercepted and an error is returned. Java code local authed = false function read_query (packet) if (authed = false) then if packet: byte () = proxy. COM_QUERY then if (packet: sub (2): lower () = "select 2013 from dual") then authed = true else proxy. response. type = proxy. MYSQLD_PACKET_ERR proxy. response. errmsg = "unauthed connection !!! "Return proxy. PROXY_SEND_RESULT end else proxy. response. type = proxy. MYSQLD_PACKET_ERR proxy. response. errmsg =" unauthed connection !!! "Return proxy. PROXY_SEND_RESULT end