hanchuanchuan / goInception

一个集审核、执行、备份及生成回滚语句于一身的MySQL运维工具
https://hanchuanchuan.github.io/goInception/
GNU General Public License v3.0
1.59k stars 545 forks source link

不支持使用了caching_sha2_password插件的MySQL用户吗? #633

Open feiazifeiazi opened 5 months ago

feiazifeiazi commented 5 months ago

描述 Archery版本:V1.10.0 goInception版本:v1.3.0-86-g02acf74

我正在使用archery,添加了MySQL实例,用户密码加密插件为caching_sha2_password。 在执行工单的时候报错了: goInception Error: (2013, 'Lost connection to MySQL server during query') 但里面的SQL是已经执行的。 这是哪里的问题呢?是用户密码插件原因吗?

假如将用户的密码插件改为mysql_native_password,执行工单就是正常的,能看到回滚语句了。 archery在v1.8.3还不支持caching_sha2_password, 现在已经支持了。 mysql_native_password插件mysql已经要废弃了,即将要删除了。

goInception错误信息 (mib_arch_n6用户的密码插件为caching_sha2_password):

time="2024/01/25 15:51:41.688" level=error msg="lastCmd /--user='mib_arch_n6';--password='我是密码';--host='192.168.201.120';--port=4306;--execute=1;--ignore-warnings=1;--backup=1;--sleep=200;--sleep_rows=100/\n inception_magic_start;\n \n use za_ag;\n create table za_dd_i (\r\n id int unsigned not null primary key auto_increment comment 'id'\r\n ,order_code varchar(24) not null comment '订单编号'\r\n ,amount decimal(18,4) not null comment '金额'\r\n ,remark text null comment '备注'\r\n ,is_deleted tinyint not null default 0 comment '是否删除'\r\n ,create_time datetime(4) not null DEFAULT now(4) comment '创建时间'\r\n ,update_time datetime(4) NOT NULL DEFAULT now(4) ON UPDATE now(4) COMMENT '修改时间'\r\n ,optimistic_lock int UNSIGNED NOT NULL DEFAULT 1 COMMENT '乐观锁'\r\n) comment '测试archery相关功能表';\r\n\r\ninsert into za_dd_i(id,order_code,amount) select 1,'k001','11';\r\ninsert into za_dd_i(order_code,amount) values(UUID_SHORT(),'11');\r\ninsert into za_dd_i(order_code,amount) select 'k001','11';\r\n\r\nupdate za_dd_i set remark='测试' where id=1;\r\n\r\ndelete from za_dd_i where id=2;\n inception_magic_commit;, runtime error: invalid memory address or nil pointer dereference, goroutine 238 [running]:\ngithub.com/hanchuanchuan/goInception/server.(clientConn).Run.func1(0xc0003e4dd0, 0xc0000eddae)\n\t/go/src/github.com/hanchuanchuan/goInception/server/conn.go:420 +0x105\npanic(0x15f05a0, 0x2a3a720)\n\t/usr/local/go/src/runtime/panic.go:969 +0x166\ngithub.com/hanchuanchuan/go-mysql/mysql.(Resultset).GetValue(0x0, 0x0, 0x1, 0xc0003acdc0, 0x186168f, 0x2c, 0xc006fe5220)\n\t/go/pkg/mod/github.com/hanchuanchuan/go-mysql@v0.0.0-20200114082439-6d0d8d3a982e/mysql/resultset.go:238 +0x26\ngithub.com/hanchuanchuan/go-mysql/mysql.(Resultset).GetString(0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0xc006fe5220)\n\t/go/pkg/mod/github.com/hanchuanchuan/go-mysql@v0.0.0-20200114082439-6d0d8d3a982e/mysql/resultset.go:401 +0x4c\ngithub.com/hanchuanchuan/go-mysql/replication.(BinlogSyncer).registerSlave(0xc0004cb8c0, 0xc0000ecd00, 0x18)\n\t/go/pkg/mod/github.com/hanchuanchuan/go-mysql@v0.0.0-20200114082439-6d0d8d3a982e/replication/binlogsyncer.go:253 +0x164\ngithub.com/hanchuanchuan/go-mysql/replication.(BinlogSyncer).prepare(0xc0004cb8c0, 0x16bb520, 0xc0004e3600)\n\t/go/pkg/mod/github.com/hanchuanchuan/go-mysql@v0.0.0-20200114082439-6d0d8d3a982e/replication/binlogsyncer.go:331 +0x48\ngithub.com/hanchuanchuan/go-mysql/replication.(BinlogSyncer).prepareSyncPos(0xc0004cb8c0, 0xc000321460, 0xe, 0xecebae, 0xc0000eccf0, 0x1)\n\t/go/pkg/mod/github.com/hanchuanchuan/go-mysql@v0.0.0-20200114082439-6d0d8d3a982e/replication/binlogsyncer.go:602 +0x2f\ngithub.com/hanchuanchuan/go-mysql/replication.(BinlogSyncer).StartSync(0xc0004cb8c0, 0xc000321460, 0xe, 0xecebae, 0x0, 0x0, 0x0)\n\t/go/pkg/mod/github.com/hanchuanchuan/go-mysql@v0.0.0-20200114082439-6d0d8d3a982e/replication/binlogsyncer.go:368 +0x155\ngithub.com/hanchuanchuan/goInception/session.(session).parserBinlog(0xc0002cd100, 0x1ac4280, 0xc0003fc7c0)\n\t/go/src/github.com/hanchuanchuan/goInception/session/parser.go:254 +0x54c\ngithub.com/hanchuanchuan/goInception/session.(session).executeCommit(0xc0002cd100, 0x1ac4280, 0xc0003fc7c0)\n\t/go/src/github.com/hanchuanchuan/goInception/session/session_inception.go:821 +0x47b\ngithub.com/hanchuanchuan/goInception/session.(session).executeInc(0xc0002cd100, 0x1ac4280, 0xc0003fc7c0, 0xc0004a8001, 0x4cf, 0x0, 0x0, 0x0, 0x0, 0x0)\n\t/go/src/github.com/hanchuanchuan/goInception/session/session_inception.go:336 +0xd68\ngithub.com/hanchuanchuan/goInception/session.(session).ExecuteInc(0xc0002cd100, 0x1ac4280, 0xc0003fc7c0, 0xc0004a8001, 0x4cf, 0x0, 0x0, 0x0, 0x0, 0x0)\n\t/go/src/github.com/hanchuanchuan/goInception/session/session_inception.go:125 +0x1c8\ngithub.com/hanchuanchuan/goInception/server.(TiDBContext).Execute(0xc0004f2660, 0x1ac4280, 0xc0003fc7c0, 0xc0004a8001, 0x4cf, 0x0, 0x0, 0x0, 0xc0000edb50, 0xc0083f8110)\n\t/go/src/github.com/hanchuanchuan/goInception/server/driver_tidb.go:259 +0x7c\ngithub.com/hanchuanchuan/goInception/server.(clientConn).handleQuery(0xc0003e4dd0, 0x1ac4280, 0xc0003fc7c0, 0xc0004a8001, 0x4cf, 0x0, 0x0)\n\t/go/src/github.com/hanchuanchuan/goInception/server/conn.go:880 +0xae\ngithub.com/hanchuanchuan/goInception/server.(clientConn).dispatch(0xc0003e4dd0, 0xc0004a8001, 0x4d0, 0x4d0, 0x0, 0x0)\n\t/go/src/github.com/hanchuanchuan/goInception/server/conn.go:632 +0x6e7\ngithub.com/hanchuanchuan/goInception/server.(clientConn).Run(0xc0003e4dd0)\n\t/go/src/github.com/hanchuanchuan/goInception/server/conn.go:465 +0x161\ngithub.com/hanchuanchuan/goInception/server.(Server).onConn(0xc0083eae00, 0x1ad8960, 0xc00000e360)\n\t/go/src/github.com/hanchuanchuan/goInception/server/server.go:327 +0x21d\ncreated by github.com/hanchuanchuan/goInception/server.(*Server).Run\n\t/go/src/github.com/hanchuanchuan/goInception/server/server.go:272 +0x3f8\n" file=conn.go func=func1 line=422

image

重现

环境

参数

zmix999 commented 5 months ago

我这边使用caching_sha2_password认证,测试没出现过这种问题,我用的MySQL-8.0.35