Home > Database > Mysql Tutorial > How to Fix 'Lost Connection to MySQL Server During Query' Error in Workbench?

How to Fix 'Lost Connection to MySQL Server During Query' Error in Workbench?

Susan Sarandon
Release: 2025-01-19 05:46:10
Original
206 people have browsed it

How to Fix

Resolving the "Lost Connection to MySQL Server During Query" Error

Adding an index to a MySQL table in Workbench can sometimes result in the error "Error Code: 2013. Lost connection to MySQL server during query," particularly with lengthy queries. Here's how to fix it:

Solution: Extending the Connection Timeout

Modern MySQL Workbench versions offer a configurable connection timeout. To change this setting:

<code>Go to Edit → Preferences → SQL Editor → DBMS connection read time out (in seconds):</code>
Copy after login

Increase the timeout, for example, to 6000 seconds.

Additional Troubleshooting Steps

  1. Limit Rows (Disable): Uncheck the "limit rows" option when dealing with extensive datasets. This can prevent timeouts during searches.
  2. Network Stability: Verify your network connection remains consistent and uninterrupted during query execution.
  3. MySQL Server Timeout Settings: If the problem persists, review and adjust the timeout settings within the MySQL server itself. Consult the official MySQL documentation for guidance on configuring connection timeouts.

The above is the detailed content of How to Fix 'Lost Connection to MySQL Server During Query' Error in Workbench?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template