1批量更新mysql数据时报错:====================================
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x20 pc=0x5e7a12]
MySQL出现错误1205-Lock wait timeout exceeded; try restarting transaction
goroutine 36 [running]:
_/E_/szm/go_project/mysqlop/dbs.Label(0x13, 0xdbba1, 0xe7ef1, 0xc000214000, 0x17bf, 0x828000)
E:/szm/go_project/mysqlop/dbs/user.go:74 +0x272
created by main.loop
E:/szm/go_project/mysqlop/main.go:54 +0x44d
Process finished with exit code 2
2解决方法:======================================================
登陆服务器
mysql -uroot -pTogeData 进入mysql
show variables like 'innodb_lock_wait_timeout';
set global innodb_lock_wait_timeout=1500; 更改锁时间限制
3其他:不用动
show variables like 'wait_timeout';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wait_timeout | 100 |
+---------------+-------+
1 row in set (0.00 sec)
set global wait_timeout=28800;