修复 strict_mode模式下查询连接信息的 bug

This commit is contained in:
xiaobiao 2021-11-30 15:50:42 +08:00
parent 19d10e090a
commit b0e0d6a73d
1 changed files with 5 additions and 1 deletions

View File

@ -20,9 +20,13 @@ func expandLocalMysql(port int) (mysqlHost *du.MysqlDB) {
}
func querySessionInfo(snifferPort int, clientHost *string) (user, db *string, err error) {
if clientHost == nil {
return
}
mysqlServer := expandLocalMysql(snifferPort)
querySQL := fmt.Sprintf(
"SELECT user, db FROM information_schema.processlist WHERE host='%s'", clientHost)
"SELECT USER AS user, DB AS db FROM information_schema.processlist WHERE HOST='%s'", *clientHost)
// log.Debug(querySQL)
queryRow, err := mysqlServer.QueryRow(querySQL)
if err != nil {