Try it FREE
Knowledge Base Frequently Asked Questions   Phone Phone: +1 (720) 336-8323 M-F 9am-5pm MST   Download Free
Free Trial
Knowledge Base
Knowledge Base » Errors and Troubleshooting » Lost connection to MySQL
Lost connection to MySQL

Source: MySQL manual


There are three likely causes for this error message.


Usually it indicates network connectivity trouble and you should check the condition of your network if this error occurs frequently. If the error message includes “during query,” this is probably the case you are experiencing.


Sometimes the “during query” form happens when millions of rows are being sent as part of one or more queries. If you know that this is happening, you should try increasing net_read_timeout from its default of 30 seconds to 60 seconds or longer, sufficient for the data transfer to complete.


More rarely, it can happen when the client is attempting the initial connection to the server. In this case, if your connect_timeout value is set to only a few seconds, you may be able to resolve the problem by increasing it to ten seconds, perhaps more if you have a very long distance or slow connection. You can determine whether you are experiencing this more uncommon cause by using SHOW GLOBAL STATUS LIKE 'Aborted_connects'. It will increase by one for each initial connection attempt that the server aborts. You may see “reading authorization packet” as part of the error message; if so, that also suggests that this is the solution that you need.


If the cause is none of those just described, you may be experiencing a problem withBLOB values that are larger than max_allowed_packet, which can cause this error with some clients. Sometimes you may see “packet too large” as part of the error message, and that confirms that you need to increase max_allowed_packet.

Was this helpful?
could be more helpful? send comment
4 people found this helpful
back to top