MySQL server has gone away

3.5k Views Asked by At

I executed this query on my MySql Server and it is giving me "MySQL server has gone away" Error.In following query my both table have more then 1000000 rows.

SELECT a_tab_11_10.url as url,a_tab_11_10.c5 as 't1',a_tab_12_10.c3 as 't2' 
FROM a_tab_11_10 join a_tab_12_10 on (a_tab_11_10.url)=(a_tab_12_10.url) 
order by (a_tab_11_10.c5-a_tab_12_10.c3) desc limit 10 

here is my log file but i am not getting it. Thank you @Faisal for answer and i check my log file but i am not getting it..

110111 10:19:50 [Note] Plugin 'FEDERATED' is disabled.
110111 10:19:51 InnoDB: Started; log sequence number 0 945537221
110111 10:19:51 [Note] Event Scheduler: Loaded 0 events
110111 10:19:51 [Note] wampmysqld: ready for connections. Version: '5.1.36-community-log' socket: '' port: 3306 MySQL Community Server (GPL)
110111 12:35:42 [Note] wampmysqld: Normal shutdown
110111 12:35:43 [Note] Event Scheduler: Purging the queue. 0 events
110111 12:35:43 InnoDB: Starting shutdown...
110111 12:35:45 InnoDB: Shutdown completed; log sequence number 0 945538624
110111 12:35:45 [Warning] Forcing shutdown of 1 plugins
110111 12:35:45 [Note] wampmysqld: Shutdown complete>
110111 12:36:39 [Note] Plugin 'FEDERATED' is disabled.
110111 12:36:40 InnoDB: Started; log sequence number 0 945538624
110111 12:36:40 [Note] Event Scheduler: Loaded 0 events
110111 12:36:40 [Note] wampmysqld: ready for connections. Version: '5.1.36-community-log' socket: '' port: 3306 MySQL Community Server (GPL)
110111 12:36:40 [Note] wampmysqld: Normal shutdown
110111 12:36:40 [Note] Event Scheduler: Purging the queue. 0 events
110111 12:36:40 InnoDB: Starting shutdown...
110111 12:36:42 InnoDB: Shutdown completed; log sequence number 0 945538634
110111 12:36:42 [Warning] Forcing shutdown of 1 plugins
110111 12:36:42 [Note] wampmysqld: Shutdown complete
110111 12:36:52 [Note] Plugin 'FEDERATED' is disabled.
110111 12:36:52 InnoDB: Started; log sequence number 0 945538634
110111 12:36:52 [Note] Event Scheduler: Loaded 0 events
110111 12:36:52 [Note] wampmysqld: ready for connections. Version: '5.1.36-community-log' socket: '' port: 3306 MySQL Community Server (GPL)
110111 12:37:42 [Note] wampmysqld: Normal shutdown
110111 12:37:42 [Note] Event Scheduler: Purging the queue. 0 events
110111 12:37:42 InnoDB: Starting shutdown...
110111 12:37:43 InnoDB: Shutdown completed; log sequence number 0 945538634
110111 12:37:43 [Warning] Forcing shutdown of 1 plugins
110111 12:37:43 [Note] wampmysqld: Shutdown complete
110111 12:37:46 [Note] Plugin 'FEDERATED' is disabled.
110111 12:37:46 InnoDB: Started; log sequence number 0 945538634
110111 12:37:46 [Note] Event Scheduler: Loaded 0 events
110111 12:37:46 [Note] wampmysqld: ready for connections. Version: '5.1.36-community-log' socket: '' port: 3306 MySQL Community Server (GPL)

2

There are 2 best solutions below

0
Sachin Shanbhag On

The most common reason for the MySQL server has gone away error is that the server timed out and closed the connection.

Check this link for more details -

http://dev.mysql.com/doc/refman/5.0/en/gone-away.html

1
Simone On

This error happens when the connection you established with mysql_connect is closed and the handle MYSQL* is not valid anymore. It should have nothing to do with the query itself, in fact, if the query is wrong, you get a different error message.

You should check why the connection is closed. Does mysql daemon is restarted? do you use more than one thread and a different thread invokes mysql_close?