SQLSTATE[HY000]: General error: 2006 MySQL server has gone away on running cron job magento

前端 未结 6 2212
遇见更好的自我
遇见更好的自我 2021-02-07 22:55

I am working on Magento site and I get this error:

SQLSTATE[HY000]: General error: 2006 MySQL server has gone away on running 
cron job magento

6条回答
  •  日久生厌
    2021-02-07 23:14

    If you got this error with the phpsh interpreter. I am able to reproduce this error with phpsh and a new shell to doctrine manager.

    SQLSTATE[HY000]: General error: 2006 MySQL server has gone away 
    

    With this command in the phpsh interpreter:

    php> $result = $conn->query('select psetid from psetproblems')->fetchAll();
    

    Explanation:

    This error is the MySQL timeout error. Either you waited too long in between creating your connection and then actually using it, or you made an error with one of your commands and you ruined the connection. The simplest solution is to stop, restart everything and don't run the command that throws an error, and do it quickly. It should work.

    Solution

    Restart your interpreter. Don't submit errors and be faster in issuing your commands through your interpreter.

    You could increase the timeout length of your MySQL connection for PHP. Then you can wait longer between creating a connection, then using it.

提交回复
热议问题