【 TiDB 使用环境】
生产环境
【 TiDB 版本】
5.7.25-TiDB-v6.1.4
【复现路径】做过哪些操作出现的问题
创建用create user
分配权限grant privileges
【遇到的问题:问题现象及影响】
mysql> create user x@10.1.11.111 identified by password ‘xxxx@88888#!’;
ERROR 1827 (HY000): The password hash doesn’t have the expected format. Check if the correct password algorithm is being used with the PASSWORD() function.
mysql>
mysql> grant select on ABC.* to x@10.1.11.111;
ERROR 1105 (HY000): runtime error: invalid memory address or nil pointer dereference
mysql> flush privileges ;
ERROR 2013 (HY000): Lost connection to MySQL server during query
【资源配置】
【附件:截图/日志/监控】
tidb日志:
[2023/04/10 10:32:11.037 +08:00] [WARN] [session.go:1966] [“run statement failed”] [conn=7866024932374141093] [schemaVersion=38520] [error=“[executor:1827]The password hash doesn’t have the expected format. Check if the correct password algorithm is being used with the PASSWORD() function.”]
[2023/04/10 10:32:11.046 +08:00] [ERROR] [conn.go:1056] [“connection running loop panic”] [conn=7866024932374141093] [lastSQL=“grant select on ABC.* to x@10.1.11.111”] [err=“runtime error: invalid memory address or nil pointer dereference”] [stack=“github.com/pingcap/tidb/server.(*clientConn).Run.func1\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:1059\nruntime.gopanic\n\t/usr/local/go/src/runtime/panic.go:884\ngithub.com/pingcap/tidb/executor.(*ExecStmt).Exec.func1\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/adapter.go:371\nruntime.gopanic\n\t/usr/local/go/src/runtime/panic.go:884\nruntime.panicmem\n\t/usr/local/go/src/runtime/panic.go:260\nruntime.sigpanic\n\t/usr/local/go/src/runtime/signal_unix.go:835\ngithub.com/pingcap/tidb/executor.(*GrantExec).Next\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/grant.go:168\ngithub.com/pingcap/tidb/executor.Next\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/executor.go:319\ngithub.com/pingcap/tidb/executor.(*ExecStmt).handleNoDelayExecutor\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/adapter.go:666\ngithub.com/pingcap/tidb/executor.(*ExecStmt).handleNoDelay\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/adapter.go:517\ngithub.com/pingcap/tidb/executor.(*ExecStmt).Exec\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/adapter.go:465\ngithub.com/pingcap/tidb/session.runStmt\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/session/session.go:2094\ngithub.com/pingcap/tidb/session.(*session).ExecuteStmt\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/session/session.go:1963\ngithub.com/pingcap/tidb/server.(*TiDBContext).ExecuteStmt\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/driver_tidb.go:230\ngithub.com/pingcap/tidb/server.(*clientConn).handleStmt\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:2022\ngithub.com/pingcap/tidb/server.(*clientConn).handleQuery\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:1876\ngithub.com/pingcap/tidb/server.(*clientConn).dispatch\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:1371\ngithub.com/pingcap/tidb/server.(*clientConn).Run\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:1121\ngithub.com/pingcap/tidb/server.(*Server).onConn\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/server.go:559”]
【解决】
原因:导致tidb panic的原因如提示,是SQL写错了 【create user x@10.1.11.111 identified by password ‘xxxx@88888#!’;】这一句里多了一个password单词,把它去掉再重新执行语句就ok了。
优化建议:SQL写错去执行的返回异常需要优化下,不应该是导致tidb panic,出现TiDB线程崩溃的现象