Coder Perfect

2013 is the error code. Lost connection to MySQL server during query


I received the following Error Code: 2013. When I tried to add an index to a table using MySQL Workbench, I got a lost connection to MySQL server during query error. It also displays everytime I do a long query, as I’ve noted.

Is there a method to raise the value of the timeout?

Asked by user836026

Solution #1

Specific timeouts can now be changed in new versions of MySQL WorkBench.

It was under Edit Preferences SQL Editor DBMS Connection for me. 600 seconds (read time out)

The value has been changed to 6000.

Limit rows was also unchecked, as putting a limit in every time I wanted to search the entire data set became tedious.

Answered by eric william nord

Solution #2

If your query contains blob data, this problem can be resolved by making the following my.ini change:


This will be set to 1M by default (the allowed maximum value is 1024M). If the value entered is not a multiple of 1024K, it will be rounded up to the next multiple of 1024K.

Setting the max allowed packet from 1M to 16M fixed the 2013 issue that appeared for me when running a long query, but the cited discussion is about the MySQL error 2006.

The flag can be found in the [wampmysqld] section for WAMP users.

Answered by Harti

Solution #3

Start the database server with the commandline options net read timeout / wait timeout and a reasonable value (in seconds), such as —net read timeout=100.

For reference see here and here.

Answered by Yahia

Solution #4

In the /etc/mysql/cnf file, add the following:

innodb_buffer_pool_size = 64M


key_buffer              = 16M
max_allowed_packet      = 16M
thread_stack            = 192K
thread_cache_size       = 8
innodb_buffer_pool_size = 64M

Answered by MysqlMan

Solution #5

SET @@local.net_read_timeout=360;

Warning: If you use it on a remote connection, the following will not work:

SET @@global.net_read_timeout=360;

360 seconds is the number of seconds.

Answered by user1313024

Post is based on