MySQL: how to fix ‘ERROR 2006 (HY000) at line ##: MySQL server has gone away’

If you get mentioned error while restoring big database, make sure you have enough size of max_allowed_packet.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
[mysqld]
max_allowed_packet=64M
[mysqld] max_allowed_packet=64M
[mysqld]
max_allowed_packet=64M

After adding it to your /etc/my.cnf restart MySQL server to apply changes.