Got a packet bigger than ‘max_allowed_packet’ bytes

I got this on a newly installed server when I tried to import a database:

[root@host ~]# mysql -u user -pPassword database < database.sql
Enter password:
ERROR 1153 (08S01) at line 53: Got a packet bigger than 'max_allowed_packet' bytes

It’s easily fixable. The default is probably 16M, I added the following in /etc/my.cnf

max_allowed_packet=32M

And restarted mysql (depending on your distro you will do this differently):

service mysqld restart