mysql> show processlist;
+----+------+-----------+------+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+------+-----------+------+---------+------+-------+------------------+
| 1 | test | | NULL | Sleep | 4 | | NULL |
| 2 | root | localhost | NULL | Query | 0 | init | show processlist |
| 3 | test | localhost | test | Sleep | 6 | | NULL |
+----+------+-----------+------+---------+------+-------+------------------+
3 rows in set (0.00 sec)
模拟持有的read 锁ID为3,
ID=3:
mysql> lock table t1 read;
Query OK, 0 rows affected (0.00 sec)
mysql> show processlist;
+----+------+-----------+------+---------+------+-------+------------------+
| Id | User | Host | d
找出mysql 中谁持有表锁
最新推荐文章于 2024-04-18 23:53:05 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)