MySQL Workbench: Error Code: 2006. MySQL server has gone away

Seems a recent MySQL and/or MySQL Workbench update has affected my Workbook sessions: if I've left Workbench open overnight, then when I try to read/write from/to the DBMS the following morning, I get:

Error Code: 2006. MySQL server has gone away

This necessitates me closing the Workbench 'Local Instance MySQL' window I was working on the night before and opening a new one.

I tried Edit>Preferences>SQL Editor>MySQL Session>DBMS connection keep-alive interval: 259200

I also added the Server System Variable 'wait_timeout = 259200' to my.ini and restarted MySQL.

Neither resolved the matter.
SAbboushiAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
Here is a lot of information on that error:  https://dev.mysql.com/doc/refman/5.7/en/gone-away.html  Note that a number of them are not under your control.  A short interruption anywhere in the network can cause it also.  My primary web hosting restarts their servers at 5AM everyday to load new changes so I would be unable to keep the connection past that point.
SAbboushiAuthor Commented:
Thanks Dave.  Maybe I should have clarified that this is a local server on my PC.  I hope to take a look at the link tomorrow.
Dave BaldwinFixer of ProblemsCommented:
That is a significant difference.  Take a look to see what processes may be running during the night.
Protecting & Securing Your Critical Data

Considering 93 percent of companies file for bankruptcy within 12 months of a disaster that blocked access to their data for 10 days or more, planning for the worst is just smart business. Learn how Acronis Backup integrates security at every stage

SAbboushiAuthor Commented:
What is your thinking re: what type of process might affect the session connection?

Also, I never experienced this problem in the years I've been using MySQL & Workbench on Windows.  That is why I suspect that the recent MySQL / Workbench update "broke" something.  Unless I can find a resolution, I may consider uninstalling/reinstalling prior versions to see if that resolves the problem... but would rather someone point me to a way to resolve with current versions, assuming my hypothesis is correct.
Dave BaldwinFixer of ProblemsCommented:
As far as I know, the MySQL programs don't automatically update themselves like Windows does.  ??  In the MySQL doc that I linked above, it says...
By default, the server closes the connection after eight hours if nothing has happened.
Since that has been true since MYSQL 5.0, I'm surprised you haven't had this happen before.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Julian HansenCommented:
Install another SQL tool (Heidi / SQL Yog) and run them in parallel - see if that gives you any further insight - if all report issues then you have a network or more likely server / service issue.

If they don't then maybe WB is just a bit wonkey - I hardly ever use it myself being more of Yog man.
SAbboushiAuthor Commented:
>> By default, the server closes the connection after eight hours if nothing has happened.
Thanks Dave: the key words to me are "By default".  I wonder if I may have tweaked the default setting years ago, whatever that setting is?

>> if all report issues then you have a network or more likely server / service issue.
Thanks Julian: I'll look into this
Dave BaldwinFixer of ProblemsCommented:
I don't know but the article I linked does mention extending the timeout.
SAbboushiAuthor Commented:
Dave: I tried the wait_timeout before posting -- didn't work.  The link you posted referred to another timeout: interactive_timeout.  I've just added that setting.  Should find out tomorrow am whether that solved the problem.

Still mystified: I haven't changed the MySQL settings since 2012 and since datetime stamp of my.ini file says 2012, it doesn't appear to have been changed by any MySQL/Workbench updates either.  So don't know the cause of the overnight timeouts whereas before, the connection hadn't timed out in several days of inactivity.
Dave BaldwinFixer of ProblemsCommented:
I'm not sure what to tell you since it was never supposed to work that way.  All of the 5.x documentation says the timeout was 8 hours.
Dave BaldwinFixer of ProblemsCommented:
I'm not sure what to tell you since it was never supposed to work that way.  All of the 5.x documentation says the timeout was 8 hours.
SAbboushiAuthor Commented:
>> The link you posted referred to another timeout: interactive_timeout.  I've just added that setting.

Thanks everyone for your help.  Dave, the interactive_timeout seems to have resolved the matter.  Still mystified though: my change log and my my.ini files show I have never used this option before.  So the only 2 scenarios I can think of:
1) Prior Workbench version was sending some keep-alive packets/data to MySQL Server which prevented timeouts; newer version is no longer doing that?
2) There was a bug in MySQL server that didn't enforce the default 8 hours (less likely scenario in my mind)?
SAbboushiAuthor Commented:
After further examination, I'm suspecting that Workbench is no longer honoring the "Keep-alive interval" setting (default is 600 seconds).  Per my original post, one of my first attempts  to try to prevent the timeout was to set this interval to 3 days, but that still didn't prevent the timeout, hence my supposition that this setting is no longer being honored by Workbench (alternatively, MySQL server may not be honoring the keep-alive message sent from Workbench).

Just my thoughts in case anyone feels like pursuing the matter further.
Dave BaldwinFixer of ProblemsCommented:
No, I never leave programs running overnight or even all day so I would never see an error like that anyway.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.