Created
May 15, 2020 05:31
-
-
Save ssippe/83b90c06ed62e0a159c4aec3958a547b to your computer and use it in GitHub Desktop.
mysql force deadlock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- replace: | |
-- `log` with any table | |
-- `id` with any index column on that table | |
-- 81272070 with an existing value in the index column | |
-- in connection #1 | |
START transaction; | |
select * from log where id = 81272070 FOR UPDATE; | |
select sleep(40); | |
COMMIT; | |
-- in connection #2 | |
select * from log where id = 81272070 FOR UPDATE; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment