When we frequently insert or update databases, SQL error 1205: lockwaittimeoutexceeded may be reported directly. Database deadlock. Generally, INNODB databases automatically add transactions. when we insert or update a database, if we insert or update the database frequently, the SQL error 1205 may be reported directly: lock wait timeout exceeded. Database deadlock.
Generally, the INNODB database automatically adds transactions. when a transaction is inserted or updated, the system reports an SQL error 1205 if the last commit has not been completed and a new commit is submitted: lock wait timeout exceeded. This is the mysql deadlock.
As a newbie, it is naturally helpless to encounter such a hard task. So I quickly went online and looked at the solution. I did not expect it. on the Internet, I found the corresponding solution and gave three solutions:
1 emergency solution: simple and violent show processlist; then, check which process caused the deadlock and kill it directly.
2 radical solution: select * from innodb_trx check that the transactions occupy the resources. (this solution is no longer available here. how about it? It is also irresponsible ).
3. set the wait timeout: innodb_lock_wait_timeout = 50, autocommit = on. it looks good to set the wait timeout scheme. but just as carefully, how much do you set? What if tens of thousands of data entries are updated every time? I suddenly felt that the feasibility was not high. The second one is not finished. Only the first type of simple violence can be selected.
Later, I consulted the database director. he recommended a solution for me: disable the index first, disable it, disable automatic submission, and then disable the database log. Then he gave me the operation again (of course I didn't learn it), but it was really helpful. I suggest you try it.