By default, MySQL itself breaks links through various timeout parameters.
Various interpretations of the timeout:
Connect_timeout is useful when establishing a connection, and is recommended for use with connection pooling or for poor network conditions. Interactive_timeout and wait_timeout Interactive and non-interactive links are primarily applicable to connection idle stages. Net_read_timeout and net_write_timeout are mainly connection timeouts during the busy phase of read or write.
Concrete Examples:
1, Can ' t connect to MySQL server.
Lost connection to MySQL Server at ' reading authorization packet ', System error:0
Adding connect_timeout can resolve this problem when the connection handshake may fail because of network jitter. This will engine MySQL thread occupancy problem, if possible without adding timeout, the appropriate reconnection.
2. Lost connection to MySQL server at ' reading initial communication ':
After TCP has repeatedly shook hands to establish a connection, after checking the username and password, there is IP->HOST->DNS->IP authentication, and any step may cause the thread to block due to network problems. This is due primarily to DNS instability. If you can, add "skip-name-resolve" to the configuration file to reduce the time of the domain name resolution.
3. Lost connection to MySQL server during query
This is more random. may be caused by net_read_timeout and net_write_timeout or other.
Reference article: http://www.realzyy.com/?p=491
This article is from the "Technology Achievement Dream" blog, please be sure to keep this source http://weipengfei.blog.51cto.com/1511707/1117101
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/database/MySQL/