Link to home
Start Free TrialLog in
Avatar of SAbboushi
SAbboushiFlag for United States of America

asked on

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.
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

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.
Avatar of SAbboushi

ASKER

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.
That is a significant difference.  Take a look to see what processes may be running during the night.
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.
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
>> 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
I don't know but the article I linked does mention extending the timeout.
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.
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.
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.
>> 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)?
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.
No, I never leave programs running overnight or even all day so I would never see an error like that anyway.