1

I've a MySQL 5.1.41 Server installed on a Ubuntu machine. I get connected to it through Workbench from my Windows machine over TCP/IP. I run a bigger query, after 900 seconds I got the below message, (there is no wait_timeout defined in the server's configuration file my.cnf)

Error Code: 2013. Lost connection to MySQL server during query

But when I look into the process list by using show processlist; command, I can still see my query running.

I got this link http://dev.mysql.com/doc/refman/5.0/en/gone-away.html where I found the below lines,

The problem on Windows is that in some cases MySQL does not get an error from the OS when writing to the TCP/IP connection to the server, but instead gets the error when trying to read the answer from the connection.

I'm not sure whether this is the reason for my observation.

Please clarify me on this.

Thanks in advance!!

Yashwanth Aluru
  • 1,125
  • 6
  • 21
  • 28

2 Answers2

1

Closing connection is not a reason to stop a query. A query might be update, or kind of transaction, or select with output to remote (server) file.

Closed connection is just is just means, that you will not receive any data from DBMS after executing query (data, timings - nothing).

The reason of closing connection could be different, as SO-User posted. Try increasing

on server side:

  • wait_timeout
  • max_allowed_packet

on client side:

Do not forget to reload DBMS config and restart client (for sure)

Community
  • 1
  • 1
ScayTrase
  • 1,810
  • 23
  • 36
0

In MySQL WorkBench we have an option to change timeout.

Find it under

Edit → Preferences → SQL Editor → DBMS connection read time out (in seconds): 600

Changed the value to 6000 or something higher.

Update

Lost connection to MySQL server

There are three likely causes for this error message.

Usually it indicates network connectivity trouble and you should check the condition of your network if this error occurs frequently. If the error message includes “during query,” this is probably the case you are experiencing.

Sometimes the “during query” form happens when millions of rows are being sent as part of one or more queries. If you know that this is happening, you should try increasing net_read_timeout from its default of 30 seconds to 60 seconds or longer, sufficient for the data transfer to complete.

More rarely, it can happen when the client is attempting the initial connection to the server. In this case, if your connect_timeout value is set to only a few seconds, you may be able to resolve the problem by increasing it to ten seconds, perhaps more if you have a very long distance or slow connection. You can determine whether you are experiencing this more uncommon cause by using SHOW GLOBAL STATUS LIKE 'Aborted_connects'. It will increase by one for each initial connection attempt that the server aborts. You may see “reading authorization packet” as part of the error message; if so, that also suggests that this is the solution that you need.

If the cause is none of those just described, you may be experiencing a problem with BLOB values that are larger than max_allowed_packet, which can cause this error with some clients. Sometime you may see an ER_NET_PACKET_TOO_LARGE error, and that confirms that you need to increase max_allowed_packet.

Doc link: Error lost connection and also check here

SO-user
  • 1,458
  • 2
  • 21
  • 43