Skip to main content

PDOException: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction in...

In highly loaded systems, such problem is possible. To solve it, it is necessary to turn off the deadlock

sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf

Add to mysqld section

[mysqld]

innodb_deadlock_detect = 0
innodb_lock_wait_timeout = 1000

Restart service

sudo service mariadb restart