ERROR 2006 (HY000) at line 1: MySQL server has gone away
I am facing the same problem. I am trying to restore mysqldump file to my machine. The file have size of 2.7 MB
Answers above can help, just adding my suggestion in addition as you can just bypass restrictions by directing using source command to import. As an alternative to mysql -u username -p database_name < file.sql, you can first login to mysql, select database and then import by source as below.
mysql -u username -p
mysql> use db_name;
mysql> source path-to/file.sql;