Skip to content

Magento CE 2.3.1 Warning: PDOStatement::execute(): MySQL server has gone away in Zend/Db/Statement/Pdo.php on line 228

I am setting up existing magento project with PHP 7.1 and Mysql 8.0.
when I run setup:upgrade its returning error:

Module 'Ves_Megamenu':
Installing schema... Upgrading schema... Warning: PDOStatement::execute(): MySQL server has gone away in /var/www/html/sixstreet/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php on line 228

I already increase max_allow_packet and wait_timeout but its not fixed issue.
etc/mysql/my.cnf

auto_increment_increment = 3
table_open_cache = 250
wait_timeout = 7200
max_allowed_packet=4000M
innodb_file_per_table = off
innodb-log-file-size = 2047M 
innodb-log-buffer-size = 32M

I disable the Ves_Megamenu and now its returning this error:

PHP Fatal error:  Uncaught Exception: User Error: Some transactions have not been committed or rolled back in /var/www/html/sixstreet/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php on line 3982 in /var/www/html/sixstreet/vendor/magento/framework/App/ErrorHandler.php:61
Stack trace:
#0 [internal function]: MagentoFrameworkAppErrorHandler->handler(256, 'Some transactio...', '/var/www/html/s...', 3982, Array)
#1 /var/www/html/sixstreet/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(3982): trigger_error('Some transactio...', 256)
#2 [internal function]: MagentoFrameworkDBAdapterPdoMysql->__destruct()
#3 {main}
  thrown in /var/www/html/sixstreet/vendor/magento/framework/App/ErrorHandler.php on line 61