MySQL server has gone away

MySQL server has gone away

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

Sometimes we may see this error in the error logs and expected functionality may not work. The error doesn't provide any clear information why the mysql server has gone away (connection to the server stopped) except the query where it has been failed. But if you execute the query in mysql it may work properly.

Feeling strange, Below are the two main reasons which causes this issue in most cases.

Working with large data sets.

Mysql Innodb(transactions) lock wait time out. 

Solution: To fix these common errors while working with transactions or large data sets, Increase the lock time out for transactions and increase the allowed data packet size for large data sets.

Steps:

open my.ini file which is mysql configuration file and change the settings like below.

 

max_allowed_packet = 100M

innodb_lock_wait_timeout = 500

To view or add a comment, sign in

More articles by Venkat Adapa

Explore content categories