XF 2.0 Localhost upgrade to 2.1 fails from 2.0


Well-known member
An exception occurred: [XF\Db\Exception] MySQL statement prepare error [2006]: MySQL server has gone away in src\XF\Db\AbstractStatement.php on line 217

    XF\Db\AbstractStatement->getException() in src/XF/Db/Mysqli/Statement.php at line 196
    XF\Db\Mysqli\Statement->getException() in src/XF/Db/Mysqli/Statement.php at line 39
    XF\Db\Mysqli\Statement->prepare() in src/XF/Db/Mysqli/Statement.php at line 54
    XF\Db\Mysqli\Statement->execute() in src/XF/Db/AbstractAdapter.php at line 94
    XF\Db\AbstractAdapter->query() in src/XF/Session/DbStorage.php at line 57
    XF\Session\DbStorage->writeSession() in src/XF/Session/Session.php at line 215
    XF\Session\Session->save() in src/XF/Install/App.php at line 190
    XF\Install\App->complete() in src/XF/App.php at line 2180
    XF\App->run() in src/XF.php at line 390
    XF::runApp() in install/index.php at line 14
You wanted me to upgrade, here it is @Chris D :).

Chris D

XenForo developer
Staff member
"MySQL server has gone away" indicates that the MySQL server has shutdown or otherwise closed the connection.

There are some settings that can be changed which may help. There's a similar thread here (albeit for XF 1.5):

Ultimately, though, it's a server issue.
  • Like
Reactions: sbj


Well-known member
My first search try didn't find any results, the 2nd one did.

Thanks to @gerryvz 's post from here, I just needed to increase max allowed packet