mysql -p -u username database_name < file.sql
Day: January 26, 2015
MySQL server has gone away during Import
Server timed out and closed the connection. How to fix:
- check that wait_timeout variable in your mysqld’s my.cnf configuration file is large enough. On Debian:
sudo nano /etc/mysql/my.cnf, setwait_timeout = 600seconds (you can tweak/decrease this value when error 2006 is gone), thensudo /etc/init.d/mysql restart. I didn’t check, but the default value for wait_timeout might be around 28800 seconds (8 hours). - Server dropped an incorrect or too large packet. If mysqld gets a packet that is too large or incorrect, it assumes that something has gone wrong with the client and closes the connection. You can increase the maximal packet size limit by increasing the value of max_allowed_packet in my.cnf file. On Debian:
sudo nano /etc/mysql/my.cnf, setmax_allowed_packet = 64M(you can tweak/decrease this value when error 2006 is gone), thensudo /etc/init.d/mysql restart.