Community Support

Error Number: 2006 MySQL server has gone away

Recently on our wedding photography blog we've been getting the following message when trying to upload images (after hitting submit). No changes have been made from our side and the only thing I was able to do based on Google searches was try a Database Repair which didnt help. Hoping someone can provide some insight on what needs to be done to avoid this issue so we can return to business as usual. Not sure why but each subsequent attempt produces a different Line Number.

OTHER ANSWERS

Sorry to hear about your database issue. In order for us to help you, we need more information than what you have provided. You have several websites on your account, and we can't determine which one is having the problem. Can you please provide more information on the issue by providing a URL? Also, if you can explain how you're getting to the error, it would also help.

In reviewing your account, you also posted a few support tickets for this issue. If you wish for this problem to be reviewed privately (issues reviewed on the Support Center are public), then please respond to the latest reply to your service ticket.

Apologies again that we can't provide you an immediate answer. Please let us know if you have any further questions or comments.

Hi Arnel, this is for www.eyewonderphotography.com
I login to my EE admin and create a new blog post, at the bottom of that blog post I am able to upload images images. Once I hit the submit button it processes for a few minutes then times out with the error I initially posted. Let me know what other info you need and I'll be happy to provide it. Thanks!

How large are the images that you're attempting to upload? It sounds like more than likely you are hitting the server's default wait_timeout=30 setting, limiting the time a single connection can be waited on to 30 seconds.

If you're uploading the same size images as you always have, there could be a possibility that at the time you attempted to upload them the SQL server was a bit backed up and caused it to take longer than 30 seconds. If you've increased the size or quality of your images, you might wish to scale them back so that they can upload quicker.

Taking a look at the database it looks like the last 2 entries have these sizes:

1 MB - 9/12 11:54PM
.58 MB - 9/12 11:52PM

So it very well could have been the time it took to upload one of these caused the issues. You might want to take a look at your coding and see if there is a way that you can handle all the uploading of your images prior to calling your mysql_connect statement, so that the connection isn't held open waiting for the image to be uploaded but rather just called to update the database once the image is already there.

Please let us know if you're still having issues, or if you have any further questions.

Hello, I wanted to follow up on this issue as it continues to resurface. I would like to know if you can increase the wait_timeout limit to 60? I've been having major issues effectively managing my business blog in terms of image content and with a recent loss of data I need to be able to upload images at a more frequent rate than before.

Please let me know if you can accommodate this. This would only be for the lwonder_ee database.

Unfortunately on a shared hosting server, the MySQL instance is shared between all users, and the MySQL wait_timeout setting of 30 seconds is set to allow for the most common types of database connections, and applies server-wide and can't be adjusted per user or database.

If you were on a VPS or dedicated server you would have the ability to make server-wide changes to the my.cnf file to adjust things like the MySQL wait_timeout setting.

Have you looked into adjusting your application so that it doesn't rely on leaving a connection open to the MySQL server while waiting for an image upload? This would probably be the cheaper alternative than upgrading to more advanced hosting, and the only way I can think of getting around this issue on shared hosting.