3 Mar 2022

MySQL - Lost connection to MySQL server during query - Required a solution.

PHP & Mysql

I am running a stored procedure that is returning more than 7000 user's data fetching from 12 tables including left joins and inner joins.

Sometimes It fails and throws the below error. Sorry, I can't publish the query for that due to confidentiality.

Lost connection to MySQL server during query

My MySQL version is 8.0.24 & My workbench is failing while executing the store procedure.

call fetchUsersInfor();

What should I do to fix it? is it an issue on the database server or workbench? 



5 Mar 2022

Best Answer

best answer

I think it is MySQL workbench's issue. Because of multiple request, it may block the ongoing query and stop the process, so your system CPU usage can be stay under control.


For windows:

Latest version of MySQL workbench (v8+) gives option to update such timeouts.

Go to Edit > Preference > click Sql editor > find for DBMS connection read time out: 600 (In seconds)

You need to update this seconds to 1200 or 1500 as per your choice and usage/work behavior of MySQL .


For Mac: 

Follow below option,

Preferences > SQL Editor > Go to MySQL Session > set connection read timeout interval 

Set it to 0. It will work!

© 2023 Copyrights reserved for