今天线下测试 for update
结果把 测试机mysql 锁了
上网找了篇文章 亲测可用
# 查询是否锁表
mysql> show OPEN TABLES where In_use > 0;
+-----------------+------------+--------+-------------+
| Database | Table | In_use | Name_locked |
+-----------------+------------+--------+-------------+
| xx_trade_xx | trust | 47 | 0 |
| xx_trade_xx | user_xx | 3 | 0 |
+-----------------+------------+--------+-------------+
找到了 user_xx 锁了三个...
# 查询进程
[root@dev-server logs]# mysql -ppwd -ne 'show processlist' |grep user_xxx
5919924 root 127.0.0.1:44032 xx_trade Query 24 Updating UPDATE `user_xx` SET btc_lock = btc_lock - 4159.9804 , `updated` = 1531056887\nWHERE `uid` = '1'\nAN
5919956 root 127.0.0.1:44131 xx_trade Query 19 Updating UPDATE `user_xx` SET btc_over = btc_over + 2331.1115 , `updated` = 1531056892\nWHERE `uid` = '1'
5920059 root 127.0.0.1:44634 xx_trade Query 3 Updating UPDATE `user_xx` SET btc_over = over + 757.3338 , `updated` = 1531056908\nWHERE `uid` = '1'
挨个kill
> mysql kill 5920059 5919956 5919924
参考文章 : https://blog.csdn.net/yucaifu1989/article/details/79400446