How to resolve MySQL deadlocks

Dwen
Level Up Coding
Published in
6 min readJun 15, 2023

--

Mysql deadlock.

Prepare the environment.

  1. Confirm the database version.
mysql> select @@version;
+-----------+
| @@version |
+-----------+
| 5.7.30 |
+-----------+
1 row in set (0.00 sec)

2. Confirm the database isolation level.

mysql> select @@transaction_isolation;
+-------------------------+
| @@transaction_isolation |
+-------------------------+
| REPEATABLE-READ |
+-------------------------+
1 row in set (0.00 sec)

--

--

I'm an independent entrepreneur, a developer and a father, enjoys speaking, writing, and sharing.