Saturday, 27 June 2020

MySQL: Fix Error 2013 - Lost connection to MySQL server during query

Case: You have successfully connected to a MySQL/MariaDB database. But when trying to import a large SQL file, an error occurred.
Error Code: 2013. Lost connection to MySQL server during query
- Timeout due to slow connection or too much data (Not the server's fault)
- Memory allocated is not enough: the data fields are too large ....

Quick fix:
Increase memory for Mysql package.
Edit file my.ini, find [mysqld] block, to change max_allowed_packet to a larger value (16, 32, or 128 M)
- If max_allowed_packet is not found, you can add it to your [mysqld] block yourself.
- Increasing memory capacity may affect the stability of MySQL server. So you can freely change it on your local computer, but if you are on the product server, please consider carefully. Another solution to importing large mysql files on the server is to use the command line.

Done ! Solved !

0 nhận xét:

Post a comment