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

**URL:** <https://forum.mautic.org/t/any-upgrade-gurus-out-there-could-use-some-guidance-with-a-failing-upgrade-from-v4-1-2-to-the-latest-mautic-version/26109>\
**Category:** Mautic 4 Install/Upgrade Support\
**Created:** [November 16, 2022, 10:23pm UTC](https://forum.mautic.org/t/any-upgrade-gurus-out-there-could-use-some-guidance-with-a-failing-upgrade-from-v4-1-2-to-the-latest-mautic-version/26109 "2022-11-16T22:23:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![oelleseff](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/oelleseff/32/6987_2.png) [@oelleseff](https://forum.mautic.org/u/oelleseff)\
**Post date:** [November 16, 2022, 10:23pm UTC](https://forum.mautic.org/t/any-upgrade-gurus-out-there-could-use-some-guidance-with-a-failing-upgrade-from-v4-1-2-to-the-latest-mautic-version/26109/1 "2022-11-16T22:23:01Z")

</div>

**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_ :

 ![Screen Shot 2022-11-16 at 5.15.59 PM](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/a/af2860027bd4b62c010e88fd84cb37fdeccc34c0.png)

_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](http://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.

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [November 17, 2022, 5:58am UTC](https://forum.mautic.org/t/any-upgrade-gurus-out-there-could-use-some-guidance-with-a-failing-upgrade-from-v4-1-2-to-the-latest-mautic-version/26109/2 "2022-11-17T05:58:13Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![oelleseff](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/oelleseff/32/6987_2.png) [@oelleseff](https://forum.mautic.org/u/oelleseff)\
**Post date:** [November 17, 2022, 4:32pm UTC](https://forum.mautic.org/t/any-upgrade-gurus-out-there-could-use-some-guidance-with-a-failing-upgrade-from-v4-1-2-to-the-latest-mautic-version/26109/3 "2022-11-17T16:32:20Z")

</div>

Hi Joey!

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

 ![Screen Shot 2022-11-17 at 11.24.45 AM](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/a/a9b9c6b86b2ebed25f61b9007f358e145060dc89.png)

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

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [November 17, 2022, 5:57pm UTC](https://forum.mautic.org/t/any-upgrade-gurus-out-there-could-use-some-guidance-with-a-failing-upgrade-from-v4-1-2-to-the-latest-mautic-version/26109/4 "2022-11-17T17:57:13Z")

</div>

Hey, you need some weight control.  
Check this:

> **[The great Mautic weight control – Joey Keller](https://joeykeller.com/the-great-mautic-weight-control/)**

---

<div class="post-metadata">

**Author:** ![oelleseff](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/oelleseff/32/6987_2.png) [@oelleseff](https://forum.mautic.org/u/oelleseff)\
**Post date:** [November 17, 2022, 10:59pm UTC](https://forum.mautic.org/t/any-upgrade-gurus-out-there-could-use-some-guidance-with-a-failing-upgrade-from-v4-1-2-to-the-latest-mautic-version/26109/5 "2022-11-17T22:59:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![oelleseff](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/oelleseff/32/6987_2.png) [@oelleseff](https://forum.mautic.org/u/oelleseff)\
**Post date:** [November 18, 2022, 10:18pm UTC](https://forum.mautic.org/t/any-upgrade-gurus-out-there-could-use-some-guidance-with-a-failing-upgrade-from-v4-1-2-to-the-latest-mautic-version/26109/6 "2022-11-18T22:18:39Z")

</div>

The upgrade ran successfully. Thank you!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/1X/43c63600fe51440378769136903f1fa2a9a34102.png) [@system](https://forum.mautic.org/u/system)\
**Post date:** [November 20, 2022, 10:19am UTC](https://forum.mautic.org/t/any-upgrade-gurus-out-there-could-use-some-guidance-with-a-failing-upgrade-from-v4-1-2-to-the-latest-mautic-version/26109/7 "2022-11-20T10:19:20Z")

</div>

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