mysql数据库,查询记录时,为什么无法执行 for update?

如下所示,我查询一条记录,然后主动上锁,但是总是失败,为什么?

mysql> select * from account where id = 5;
+----+-----------+---------+
| id | NAME      | balance |
+----+-----------+---------+
|  5 | zhangsang | 1000.00 |
+----+-----------+---------+
1 row in set (0.00 sec)

mysql> select * from account where id = 5 for update;
ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction

你的id是主键吗

加锁超时,看看是不是被其它锁上了。