Getting MYSQL server has gone away when importing database from .sql file
Problem: You are trying to import a .sql file using the command line mysql command but it is unsuccessful as follows:
# mysql -u douser -pdbpass yourdb < db_file.sql
ERROR 2006 (HY000) at line XXXXX: MySQL server has gone away
The solution is to edit /etc/my.cnf and add the following line to the [mysqld] section:
max_allowed_packet=64M
Then restart mysql:
# service mysqld restart
Re-run your import query (you may need to delete the partly database first and re-create it) and it will now succeed.
Related Posts:
- Site Migration and Transfer: How to Move a Website… Moving a website from one server to another, such as from a cPanel-based server to…
- Access logs are not rotated on Plesk server:… This Plesk Obisidian issue was initially handled by Plesk Support, but the solution wasn’t ideal,…
- How to Use AI to Get a Website Online Faster and… Getting a professional-looking website used to mean spending hours learning design, struggling with code, or…
- Mastering Essential Server Management: Safeguarding,… In today's fast-paced digital landscape, effective server management stands as the cornerstone of maintaining a…
- Beginners Guide: What is Web Hosting? Having an online presence is crucial, whether you're running a business, starting a blog, or…