I'm using MySQL Workbench 6.3 on my OS X 10.9.5 to manage several cloud databases (hosted on Rackspace), and I get the following issue:
When inactive for 5 minutes, the following problems happen:
So basically the connection is gone.
This is really annoying since it happens after only 5 minutes of inactivity. Therefore I need to close the connection and reopen it each time.
I also tried this: MySQL Workbench: How to keep the connection alive, which didn't change anything. In my Workbench Preferences tab, I have the following setup:
Notice that this issue happens precisely after 5 minutes of inactivity! If I run two queries in a 4'59 minutes interval it works perfectly fine. Also my colleagues who connect to the same database on their Workbench don't have this issue.
Does anybody have a solution for this?
The most common reason for the MySQL server has gone away error is that the server timed out and closed the connection. By default, the server closes the connection after 8 hours if nothing has happened. You can change the time limit by setting the wait_timeout variable when you start mysqld.
Can I adjust the timeout? Yes, go to Preferences, SQL Editor, and adjust the DBMS connection read time out option that defaults to 600 seconds. This sets the maximum amount of time (in seconds) that a query can take before MySQL Workbench disconnects from the MySQL server.
When the 'The database server instance is' status shows “stopped”, this confirms that the MySQL server has shut down. Restart the server at this point by clicking the Start Server button.
Go to Edit -> Preferences -> SQL Editor and there you'll see:
DBMS connection keep-alive interval (in seconds): 600 DBMS connection read time out (in seconds): 600 DBMS connection time out (in seconds): 60
The DBMS connection keep-alive interval means how often Workbench sends keep-alive request to the server to keep the connection alive.
Since 5 minutes == 300 seconds, set DBMS connection keep-alive interval < 300 (e. g. 250)
It will mean "send keep-alive request every 250 seconds". Click OK.
Then quit MySQL Workbench and relaunch it to make the changes take effect.
If you use Standard TCP/IP over SSH connection method, it's also can be helpful to configure ssh ServerAliveInterval as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With