Lost connection to MySQL server during query

My program errors will occur in the implementation of mysql_real_query:

Lost connection to MySQL server during query
Followed by a lot of
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)

Note: the corresponding SQL statement for the select absolutely no problem. This error is sometimes an hour there is sometimes for several days to appear.
At this time to view the PS ax |grep MySQL has no MySQL process. MySQL look at the corresponding log (/var/log/mysqld.log) why is this error message not found.
So, there is no one knows what is the problem? This problem to make a long time have not out.

Environmental Science:
CentOS 6.2
glibc 2.12
mysql 5.6.13

Started by Camille at November 26, 2016 - 2:56 PM

Have a look the error log database

Posted by Leif at December 01, 2016 - 3:51 PM

Database log median shows
130909 09:53:06 mysqld_safe Number of processes running now: 0
130909 09:53:06 mysqld_safe mysqld restarted
2013-09-09 09:53:13 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2013-09-09 09:53:13 31655 [Note] Plugin 'FEDERATED' is disabled.
2013-09-09 09:53:13 31655 [Note] InnoDB: The InnoDB memory heap is disabled
2013-09-09 09:53:13 31655 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2013-09-09 09:53:13 31655 [Note] InnoDB: Compressed tables use zlib 1.2.3
...
...


I know mysqld_safe Number of processes running now: 0 this is printed out from mysqld_safe in the script, and mysqld_safe script is the discovery of a number of the mysqld process does not after to MySQL through the PS process ax.
I think the reason not from MySQL log to obtain the process MySQL why would die.

Posted by Camille at December 02, 2016 - 4:10 PM

Check the system variable show variables like'%time%'; one possibility is timed out.

Posted by Iris at December 04, 2016 - 4:23 PM

The 1 check is allowed to connect a number of how many?
2 check whether a Login failure situation?
Add the above two points, a chance to cause.

Posted by Derek at December 17, 2016 - 4:42 PM

Wait_timeout and interactive_timeout are 8 hours, my program sometimes 2 hours off, and some even a week before he hung up, so it should be independent of the timeout.

Posted by Camille at December 26, 2016 - 4:57 PM

1 I only up to 10 connection, equivalent to the connection pool that feeling
2 I only at the beginning of the login, the back is in the implementation of query

Posted by Camille at January 03, 2017 - 4:59 PM

Top, not met~

Posted by Carey at January 03, 2017 - 6:31 PM

I think you made a lot of post on MySQL also respond to many MySQL post, you must MySQL understanding of the more thorough, this problem has troubled me for a long time.
A search on the Internet before, that there may be a bug between MySQL and glibc, MySQL in the log, some functions and MySQL glibc match will appear this kind of circumstance. But this program which is after the login to execute query to hang, excuse me you know glibc and MySQL will have the bug. in the execution of the normal query
I use centos5.6 glibc is 2.5, MySQL hanging very frequently, then change to the CentOS6.2 glibc2.12 only had a (program ran a week after MSYQL before hanging up).

Posted by Camille at January 11, 2017 - 5:52 PM