Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lost connection to MySQL server during query

On MYSQL Workbench, I'm running this query : count(*) from test.nameTable I have couple millions rows in this table . after a while I get this error : Lost connection to MySQL server during query
I saw this question and its answers in other places but none of the answers helped.
I tried setting all timeout and packet size global variables to their maximum value, and spliting my query somehow.. But none of this methods worked.

SET GLOBAL connect_timeout=10000000
SET GLOBAL net_read_timeout=10000000
SET GLOBAL max_allowed_packet=1073741824

Anyone knows what could be the problem and how to solve it please?

like image 841
Colum Srečko Avatar asked Jul 05 '15 12:07

Colum Srečko


1 Answers

If you are running from MySQL Workbench (as I can read on your comment, please update question), the program have their own timeouts.

If you go to the program menu, preferences -> SQL Editor, you have these options:

MySQL Session: DBMS connection keep-alive interval (in seconds): DBMS connection read time out (in seconds): DBMS connection time out (in seconds):

If you read descriptions from these options, you can see on the second one there's the time who workbench wait for a response from server.

like image 126
Sakura Kinomoto Avatar answered Oct 05 '22 04:10

Sakura Kinomoto