CREATE TABLE $TTT ( name varchar(50) CHARACTER SET ascii NOT NULL, value bigint UNSIGNED NOT NULL, PRIMARY KEY (name) ) ENGINE=InnoDB; insert into $TTT values ('a', 100), ('b', 100); connA: start transaction; connB: start transaction; connA: update $TTT set value = 703 where name = 'b'; connB: update $TTT set value = 795 where name != 'b'; # result is blocked by update on connA, but that is not the issue connA: update $TTT set value = 944 where name != 'b'; # deadlock is detected correctly # ERROR 1213 (40001): Deadlock found when trying to get lock; try restarting transaction # note: connB outputs result connA: select @@in_transaction; # here we read "0", ie. transaction is terminated/rolled back connA: update $TTT set value = 646; # result is blocked by update on connB, but that is not the issue connB: commit; # note: connA outputs result connA: select @@in_transaction; # here we read "1" <-- here is the problem, transaction was started without a command!