In MySQL workbench we may execute many SQL queries. Some cases queries taking long time either due to bad index or number of records are more. In this kind of long running queries we might get a error lost connection to MySQL server error code 2013. After this error transaction will be dropped. This due to default MySQL workbench allows maximum 600 sec to finish the execution and if it goes beyond that it will drop the connection. We can increase this threshold as like below.

Edit-->Preferences-->SQL Editor.

mysql-connection-timeout.JPG

After changing the settings click on save. Based on the number of records we can increase the time to avoid error code 2012 in MySQL.