Any upgrade gurus out there? Could use some guidance with a failing upgrade from v4.1.2 to the latest Mautic version

Your software
My PHP version is : 7.4 (FPM with OPCache)
*My MySQL: MySQL 5

Updating/Installing Errors
I am (delete as applicable): Upgrading to the latest Mautic Version
Upgrading/installing via (delete as applicable) : Command Line

These errors are showing in the installer :

These errors are showing in the Mautic log :
[2022-11-15 17:55:53] console.CRITICAL: Error thrown while running command “doctrine:migrations:migrate --quiet --no-interaction”. Message: “An exception occurred while executing ‘ALTER TABLE email_stats CHANGE COLUMN tokens tokens LONGTEXT CHARACTER SET ‘utf8mb4’ COLLATE ‘utf8mb4_unicode_ci’ NULL DEFAULT NULL COMMENT ‘(DC2Type:array)’;’: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away” {“exception”:“[object] (Doctrine\DBAL\Exception\ConnectionLost(code: 0): An exception occurred while executing ‘ALTER TABLE email_stats CHANGE COLUMN tokens tokens LONGTEXT CHARACTER SET ‘utf8mb4’ COLLATE ‘utf8mb4_unicode_ci’ NULL DEFAULT NULL COMMENT ‘(DC2Type:array)’;’:\n\nSQLSTATE[HY000]: General error: 2006 MySQL server has gone away at /home/smartspeech/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:115, Doctrine\DBAL\Driver\PDO\Exception(code: HY000): SQLSTATE[HY000]: General error: 2006 MySQL server has gone away at /home/smartspeech/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18, PDOException(code: HY000): SQLSTATE[HY000]: General error: 2006 MySQL server has gone away at /home/smartspeech/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:141)”,“command”:“doctrine:migrations:migrate --quiet --no-interaction”,“message”:“An exception occurred while executing ‘ALTER TABLE email_stats CHANGE COLUMN tokens tokens LONGTEXT CHARACTER SET ‘utf8mb4’ COLLATE ‘utf8mb4_unicode_ci’ NULL DEFAULT NULL COMMENT ‘(DC2Type:array)’;’:\n\nSQLSTATE[HY000]: General error: 2006 MySQL server has gone away”} {“hostname”:“server268.com”,“pid”:57731}

Your problem
My problem is : I haven’t been able to upgrade Mautic during the last few releases. Upgrading from 4.1.2
After the upgrades fail I revert to a pre-upgrade backup. Thank you

Steps I have tried to fix the problem : Searched for solutions on this forum and other spaces but none seemed directly applicable.

Thank you in advance for any advice you can offer.

Hi your error seems to be mysql server related. Do you have huge tables in your db? Lots of data? What are your server specs?

Hi Joey!

The overall size of the db is 6.5GB. This is primarily due to one table “email_stats” (attaching screenshot)

I am completely OK with purging or significantly reducing this table if it fixes the issue. we certainly don’t need stats on any email campaigns other than the last one or two campaigns.

Don’t know the overall server resources as this is basic web-shared hosting, but I am sure they are the bare minimum only.

Is 6.5 GB large for a Mautic instance? If so, is there a script to safely reduce the size of that table?

Thank you again!
Oscar

Hey, you need some weight control.
Check this:

2 Likes

Thank you! Got the database down to 1GB. Will try upgrading over the weekend to see if the size reduction makes any difference.

The upgrade ran successfully. Thank you!

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.