Error Code: 2013 Lost connection to MySQL server d

2019-07-27 11:48发布

问题:

I am executing a query which is giving this error after that its showing another error Error Code: 2006 MySQL server has gone away

I Searched in Google and find some parameters to set like connect_timeout,interactive_timeout and wait_timeout

I increased all the parameters value from its existing value but still that error is showing.

Then i created 2 test table with less no of data, then the query executed well.

My live tables having more then 50k data and i am using federated table in the query

i think due to federated data and a lot of data in my table its taking more time.

My Query

SELECT TBL.NAME1,
   TBL.NAME2 
  FROM (SELECT MLD1.LOGIN_NAME AS NAME1,
           MLD2.LOGIN_NAME AS NAME2 
      FROM FEDERATED_M_LOGIN_DETAILS MLD1 
      JOIN FEDERATED_M_LOGIN_DETAILS MLD2 
     WHERE MLD1.LOGIN_NAME < MLD2.LOGIN_NAME
  ORDER BY NAME1,NAME2) TBL    
WHERE NOT EXISTS (SELECT USER_NAME1,
                      USER_NAME2 
                 FROM CONNECTION C
                WHERE (C.USER_NAME1 = TBL.NAME1 AND C.USER_NAME2 = TBL.NAME2));

Please help me to over come from this problem.

Thanks in advance

标签: mysql timeout