Importing large SQL files sometimes may give error like

Connection timeout while query or MySQL server went away .



I came across this problem and there is specified set of steps to solve this problem.

Step 1. Login to SQL prompt

mysql -u -p

Step 2. Set network buffer length to a large byte number. The default value may throw errors for such large data files

set global net_buffer_length=1000000;

Step 3. Set maximum allowed packet size to a large byte number.The default value may throw errors for such large data files.

set global max_allowed_packet=1000000000;

Step 4. Disable foreign key checking to avoid delays,errors and unwanted behaviour

SET foreign_key_checks = 0;

Step 5. Import your sql dump file

source

Step 6. Remember to enable foreign key checks when you are done!

SET foreign_key_checks = 1;

And that’s it you are done