---
title: "Discussion on \"How to simulate a deadlock on a row in MySQL?\" | Hashnode"
description: "Discussion on \"How to simulate a deadlock on a row in MySQL?\". Question:\nTo simulate a lock in mysql I can grab the row with the following:\nBEGIN;\nSELECT * FROM table WHERE id=1 FOR UPDATE;\n\nNow, if I try and update that row (from another connection) it will raise the following error after innodb_lock_wait_timeo..."
url: "https://hashnode.com/posts/how-to-simulate-a-deadlock-on-a-row-in-mysql/686fb3561b5c472f1cb5dd12"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [How to simulate a deadlock on a row in MySQL?](https://databasedev.hashnode.dev/how-to-simulate-a-deadlock-on-a-row-in-mysql?utm_source=hashnode&utm_medium=feed)

Question: To simulate a lock in mysql I can grab the row with the following: BEGIN; SELECT \* FROM table WHERE id=1 FOR UPDATE; Now, if I try and update that row (from another connection) it will raise the following error after innodb\_lock\_wait\_timeo...

Jul 10, 2025 · 2 min read · databasedev.hashnode.dev  
Read the article

-   [#sql](https://hashnode.com/tag/sql)
-   [#mysql](https://hashnode.com/tag/mysql)
-   [#qanda](https://hashnode.com/tag/qanda)
-   [#databases](https://hashnode.com/tag/databases)
-   [#tutorial](https://hashnode.com/tag/tutorial)

## Written by

[Gabriella Barajas](https://hashnode.com/@gabbbybar)

@gabbbybar · USA

  
[View profile](https://hashnode.com/@gabbbybar)

Real Questions. Clean Answers. All About Databases.

A database Q&amp;A blog for those who’d rather debug queries than read documentation. Practical answers to real questions — mostly SQL Server and MySQL, with a pinch of sarcasm and a love for clean code.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
