Client Automatically Disconnected from a DB Instance
Scenarios
The mysql client was automatically disconnected from the DB instance. The following error information is displayed: ERROR 2013: Lost connection to MySQL server during query.
Solution
ERROR 2013 is usually caused by incorrect configuration.
- wait_timeout: indicates the number of seconds the server waits for activity on a non-interactive connection before closing it.
- interactive_timeout: indicates the number of seconds the server waits for activity on an interactive connection before closing it.
- Check whether the DB instance is available.
If the DB instance is available, check for other possible causes.
- View error logs.
- Use the mysql command-line client to connect to the DB instance. Run status to check whether the DB instance has been rebooted frequently.
Uptime indicates the running time of the DB instance. The command output shows that the DB instance has not been rebooted frequently. The client disconnection is not caused by DB instance reboots.
- Check parameters. If the values of wait_timeout and interactive_timeout are too small, the client automatically stops connections that timed out.
- Change the values of wait_timeout and interactive_timeout as required without the need of rebooting the DB instance.
- After about 10 minutes, run show databases to check whether the connection is normal.
If information similar to the preceding figure is returned, the connection is normal.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot