How does deadlock happen in MySQL, and how to deal with it?

71 views Asked by At

I know maybe this is a frequent question, and I also have searched before asking.But I still have some points cannot figure out myself, help you can help me. Thanks in advance.

  1. How does deadlock happen in MySQL? Mysql gives an example in the manual(https://dev.mysql.com/doc/refman/8.0/en/innodb-deadlock-example.html), it's seems two unrelated tables being operated, so I really don't get how deadlock occurs between two tables.

  2. I saw some people say deadlock also happened in SELECT...FOR UPDATE lock, due to process order. Is true? Does the 'SELECT...FOR UPDATE' lock put the exclusive lock initially? So how did this happen?

  3. If both can face deadlock situations, is there any workaround to deal with it?

0

There are 0 answers