Mysql Workbench: How to keep the connection alive
Prevent MySQL disconnections by adjusting wait_timeout
and interactive_timeout
. Quickly apply these settings directly in MySQL:
For permanent echo of these changes, tweak your MySQL config file:
[mysqld]
wait_timeout = 28800
interactive_timeout = 28800
Lastly, restart MySQL to bring these configurations to life.
Dive into MySQL Workbench settings
Tweak SQL Editor Preferences
Go to Edit -> Preferences -> SQL Editor
in MySQL Workbench. Here adjust DBMS connection read time out
to a tolerable value (or 0
for unlimited wait time on queries).
This would help save your connection from dying out prematurely if a query takes more than its bedtime.
Making SSH connections Immortal
Utilize an SSH tunnel with Standard TCP/IP over SSH
for a rock-solid connection. In Preferences, also set SSH KeepAlive settings to dodge SSH timeouts. Time to crank up that KeepAlive interval for uninterrupted SQL operations.
Making changes stick
To make sure the changes take hold, terminate any marathon runner queries and hit restart on MySQL Workbench. Now, the tweaked settings should keep your connection alive, but if things look south, try the good old turn-it-off-and-on-again trick with MySQL Workbench.
Strategies for solid connections
Setting a reliable safety net
Choose a DBMS connection read timeout that's more patient than the most patient query you plan to run. Long SQL script? No problem, your timeout got you covered.
SSH: Your Security & Longevity Ally
If you're a fan of overnight batch processing or handle tons of secure data transfers, setting up an SSH connection is what the IT doctor ordered. Teamed with the keep-alive settings, SSH beefs up both security and stability.
When in doubt, look back
Don't forget to use the beloved time machine, the web.archive.org link, to get old solutions to common connectivity problems and additional insights to handle MySQL Workbench settings.
Making your workflow bulletproof
Address stem to stern
Be proactive in setting your DBMS connection keep-alive interval. Don't wait for the connectivity issues to take you by surprise. Welcoming a new connection to the family or modifying an existing one? Set the right intervals straight away.
Control batch process
Batch process on the cards? Keep an eye on your MySQL settings. Make sure your configuration can weather the duration. Remember, a stitch in time prevents a SSH timeout and makes a good night's sleep possible!
Know what you don't know
After adjusting DBMS connection read timeout and KeepAlive intervals, take a stroll around your connections. Is the performance better? Stability improved? If not, don't fret. Revisit the preferences and prune them a bit more until perfection is achieved.
Was this article helpful?