• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

MySQL server has gone away

Matt C.

Active member
#1
Before I begin, I'm fully aware that this is a server issue and not a XenForo issue. However, I've tried everything by searching the Xenforo forums, google, etc and nothing seems to work. Hopefully someone can help me out. :)

Whenever I try to install addons I always get this error part way through.
Code:
An exception occurred: Mysqli prepare error: MySQL server has gone away in /var/www/html/library/Zend/Db/Statement/Mysqli.php on line 77


Zend_Db_Statement_Mysqli->_prepare() in Zend/Db/Statement.php at line 115
Zend_Db_Statement->__construct() in Zend/Db/Adapter/Mysqli.php at line 381
Zend_Db_Adapter_Mysqli->prepare() in Zend/Db/Adapter/Abstract.php at line 478
Zend_Db_Adapter_Abstract->query() in XenForo/Model.php at line 219
XenForo_Model->fetchAllKeyed() in XenForo/Model/RoutePrefix.php at line 41
XenForo_Model_RoutePrefix->getPrefixesByRouteType() in XenForo/Model/RoutePrefix.php at line 54
XenForo_Model_RoutePrefix->getPrefixesForRouteCache() in XenForo/Link.php at line 487
XenForo_Link::_loadHandlerInfoForGroup() in XenForo/Link.php at line 404
XenForo_Link::_getPrefixHandler() in XenForo/Link.php at line 370
XenForo_Link::_buildLink() in XenForo/Link.php at line 97
XenForo_Link::buildPublicLink() in XenForo/Dependencies/Admin.php at line 197
XenForo_Dependencies_Admin->getEffectiveContainerParams() in XenForo/FrontController.php at line 637
XenForo_FrontController->renderView() in XenForo/FrontController.php at line 158
XenForo_FrontController->run() in /var/www/html/admin.php at line 13
You should know that my server is from DigitalOcean, so I manage it myself. I am running PHP 7.0.18 with MySQL 5.0.12-dev. Here is everything I've tried, with no success.

I've added these to /etc/mysql/my.cnf:
Code:
wait_timeout = 28800
interactive_timeout = 28800
max_allowed_packet  = 256M
I've also tried adding these to php.ini:
Code:
mysql.connect_timeout = 300
default_socket_timeout = 300
That's what I've tried. If someone could help me out, that would be fantastic. Thank you!

Edit: Yes, I've restarted the MySQL server.
 
Last edited:

Robru

Well-known member
#10
If I see this, database tables have been crashed.

How to optimize and auto repair all MySQL databases using SSH:
Code:
mysqlcheck -uroot -p --auto-repair --optimize --all-databases
 

Matt C.

Active member
#11
If I see this, database tables have been crashed.

How to optimize and auto repair all MySQL databases using SSH:
Code:
mysqlcheck -uroot -p --auto-repair --optimize --all-databases
I ran that, and I started the process but after a little bit I got this error.
Code:
mysqlcheck: Got error: 2013: Lost connection to MySQL server during query when executing 'OPTIMIZE TABLE ... '
 

Robru

Well-known member
#18
And if you post a message on your forum?

It is now logical that you first fix all errors from the error.log before continuing with addons install.
You must first tackle the problem.
 

Matt C.

Active member
#19
And if you post a message on your forum?

It is now logical that you first fix all errors from the error.log before continuing with addons install.
You must first tackle the problem.
Posting messages on the forum works. Well whenever the addon is installing and at the exact moment the error comes up, nothing else on the site will work. However if I refresh the addon install page, it'll finish and everything goes back to normal.