create table t1
(
tID int primary key,
tName nvarchar(4)
);insert into t1 select 1,'a1'
union select 2,'a2'
union select 3,'a3';create table t2
(
tID int primary key,
tName nvarchar(4)
);insert into t2 select 101,'b1'
union select 102,'b2'
union select 103,'b3lock table t1 read; -- 以只读方式锁定t1表
select * from t2; -- 查询t2,报错在用只读方式锁定t1表后,为什么不能访问(查询)其它表(t2).锁定t1表,不能更新它我能理解,为什么连其它的表也要一起锁定呢?MySql是基于什么样的思想要这样设计的呢?上面的只读锁能否理解成共享锁?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货