create table test_lock (
id int,
name varchar(255),
primary key (id),
unique (name)
)ENGINE=InnoDB default charset=utf8mb4;
insert test_lock values(1,'1001'),(2,'1002'),(3,'1003'),(4,'1004');
事务1
set autocommit=0;
update test_lock set id = 10 where name = 1002;
commit;
事务2
set autocommit=0;
update test_lock set name='1099' where id = 4;
commit;
转载请注明原文地址:https://blackberry.8miu.com/read-3656.html