cancel
Showing results for 
Search instead for 
Did you mean: 

MySQL server has gone away when using: bin/magento deploy:mode:set production

SOLVED
   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

MySQL server has gone away when using: bin/magento deploy:mode:set production

Magento 2.3.x

I get an error when I try to set mode to production which is:

"Warning: PDOStatement::execute(): MySQL server has gone away in /magento2/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php on line 228"

 

I have searched Magento forums and found this link: https://devdocs.magento.com/guides/v2.3/install-gde/trouble/tshoot_mysql_table-open-cache.html.
My hosting provider has set "table_open_cache=500", which is double what Magento recommends in the link but the issue persists.

 

Full error stack:

~/php72 bin/magento deploy:mode:set production
Enabling maintenance mode
Starting compilation
Compilation was started.
%message% 0/7 [>---------------------------] 0% < 1 sec 72.5 MiB%message% 0/7 [>---------------------------] 0% < 1 sec 72.5 MiBProxies code generation... 0/7 [>---------------------------] 0% < 1 sec 72.5 MiB
Proxies code generation... 1/7 [====>-----------------------] 14% < 1 sec 74.5 MiB
Repositories code generation... 1/7 [====>-----------------------] 14% < 1 sec 74.5 MiB
Repositories code generation... 2/7 [========>-------------------] 28% 8 secs 209.0 MiB
Service data attributes generation... 2/7 [========>-------------------] 28% 8 secs 209.0 MiB
Service data attributes generation... 3/7 [============>---------------] 42% 8 secs 209.0 MiB
Application code generator... 3/7 [============>---------------] 42% 8 secs 209.0 MiB
Application code generator... 4/7 [================>-----------] 57% 16 secs 231.0 MiB
Interceptors generation... 4/7 [================>-----------] 57% 16 secs 231.0 MiB
Interceptors generation... 5/7 [====================>-------] 71% 38 secs 257.0 MiB
Area configuration aggregation... 5/7 [====================>-------] 71% 38 secs 257.0 MiB
Area configuration aggregation... 6/7 [========================>---] 85% 45 secs 345.0 MiB
Interception cache generation... 6/7 [========================>---] 85% 45 secs 345.0 MiB
Interception cache generation... 7/7 [============================] 100% 51 secs 345.0 MiB
Generated code and dependency injection configuration successfully.
Compilation complete
Starting deployment of static content
Disabling maintenance mode


Warning: PDOStatement::execute(): MySQL server has gone away in /..../magento2/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php on line 228

 

Any help would be appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: MySQL server has gone away when using: bin/magento deploy:mode:set production

Hello @todd_robards

 

Please try with below-shared command:

 

php bin/magento deploy:mode:set production -s
Manish Mittal
https://www.manishmittal.com/

View solution in original post

1 REPLY 1

Re: MySQL server has gone away when using: bin/magento deploy:mode:set production

Hello @todd_robards

 

Please try with below-shared command:

 

php bin/magento deploy:mode:set production -s
Manish Mittal
https://www.manishmittal.com/