lock table 表名 exclusive mode nowait; -- 锁整个表select * from 表名 where XXX for update nowaitl -- 锁符合条件的记录