It may be possible that your database is very heavy (i.e. many records) and the value of variable wait_time is very low in the MySQL configuration file. Although the default value of wait_time is 28800 seconds, do not set such high value as a bad code can cause issues. Here are the steps:
- If you have root access, open my.cnf (MySQL) or mariadb.cnf (MariaDB) in an editor.
# vi /etc/mysql/mariadb.cnf
- Update the following variables.
# systemctl restart mariadb.service
# systemctl restart mysql.service
If you still get the same error, increase the value of wait_timeout.