我不确定行级锁是如何工作的,但这里是我的问题我有一个表T (id int,balance int )(引擎= InnoDB ),我想锁定ID = 1的行,所以我像这样启动了一个事务:select * from T where ID = 1 FOR UPDATE ; UPDATE T set balance = balance + 8500 where ID = 2 ;
php$r=mysql_query("SELECT max(Ticket) from ticket FOR UPDATE");$k=$row[0];for ($j=1;$j<100000;$j++) { $r=mysql_query("insert into ticket(Ticket) values ('$k&