Magento – Error while sending query packet

[Magento 2.1.x+] Should you have an older aMiSTACX AMI for Magento release prior to v1.3 you may encounter an error while running a backup within the Magento Admin Console.

Error while sending QUERY packet [PID] in /var/www/magento/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php on line 228

To resolve:

Use SSH CLI or WinSCP to edit the MySQL Global Configuration File.

SSH CLI shown:

sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

Increase the value of wait timeout from 20 to 300

wait_timeout = 300

Save file

Restart MySQL service

sudo service mysql restart

Even better, don’t use the Admin Console for any upgrade or install. Use Ubuntu CLI for Magento module installs.

You are now good to go!