MariaDB / Plesk Error: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded
Should you encounter the error
SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded
the first step is to analyze your MariaDB log files. You can find the location of the log files with the command
grep -R log_error /etc/mysql/*
and then open the log.
nano /var/log/mysql/error.log
In my case this error occurred several times:
Aborted connection 434275 (Got an error reading communication packets)
The reason might be too short execution times, so we increase the maximum execution time in PHP and additionally in the database by changing the configuration with
nano /etc/mysql/nano my.cnf
and add the following content under [mysqld]:
connect_timeout = 600
net_read_timeout = 600
wait_timeout = 28800
interactive_timeout = 28800
innodb_thread_concurrency = 0 #makes everything faster
skip-name-resolve = 1 #skip name resolution
After that we restart the service with
service mysql restart