sql
BEGIN;
SELECT * FROM base_acc_btc WHERE cid = 100470210 FOR UPDATE;
UPDATE base_acc_btc SET freemargin = freemargin + 2 WHERE cid = 100470210;
commit;
show global variables like "%timeout%";
set global innodb_lock_wait_timeout = 10;
查看正在锁的事务
SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS;
查看等待锁的事务
SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS;