myisam引擎执行的sql:
lock table test_myisam read;
select * from test_myisam where id = 1;
update test_myisam set name ='11' where id =1;
执行update 报错
innodb引擎执行的sql:
set autocommit = false;
select * from student where id = 1 lock in share mode;
select * from student where id = 1 for update;
update student set name ='11' where id =1 ;
上面所有语句都可以正常执行
我的疑问是,同一个session中myisam加上共享锁后执行update,因为有共享锁了所以无法加排它锁报错,那为什么在innodb中我加了共享锁,再加排它锁却不报错呢